mysql> 12 simple but staple commands

Edit at:  2019-12-28 16:52:42

  • 1.mysql -u+username -p+password  --> connect mysql
  • 2.use databasename  --> select database
  • 3.show databases  --> show all databases in your mysql server
  • 4.show tabels  --> show all tables which are in selected database
  • 5.create database database_name [charset charset_name]  -->create database
  • 6.drop database database_name  --> delete database which named database_name
  • 7.create table table_name(

   var1 type,

   var2 type)   --> create table table_name and its inside structure

  • 8.drop table table_name  --> delete table which called table_name
  • 9.rename table old_table_name to new_tabl_name  --> change your table's name
  • 10.insert into table_name values (key1, value1), (key2, value2)  -->insert dataline to a table
  • 11.truncate table_name  --> clear a table with a efficient way
  • 12.select * from table_name  --> show all datalines of table table_name
posted @ 2019-12-28 16:53  code_explorer  阅读(93)  评论(0编辑  收藏  举报