Operation of the database under Ubuntu

Because repeatedly found himself always check them, so a good memory as bad written, write down the best.

  • Ubuntu into the root privileges $ su root
  • Log in MySQL $ mysql -u root -p (password to enter the next, as to forget the password the next question write)
  • List all the database mysql> show databases; (Here we must note that there s still a semicolon!)
  • Create a database named database_name mysql> create database database_name;
  • Entering a database mysql> use database_name;
  • Structures listed in Table mysql> show columns from table_name;
  • Delete table mysql> drop table table_name;
  • Delete database mysql> drop database database_name;
  • Exit MySQL mysql> quit;
  • Create a table MySQL> the Create the Table table_name ( the above mentioned id int (10) not null Primary Key AUTO_INCREMENT,  name VARCHAR (40),  password VARCHAR (40)  ); (middle after beating comma can begin a new line to write, to remember the last semicolon )
  • Display table data structure mysql> describe table_name;

Guess you like

Origin blog.csdn.net/Alina_catty/article/details/80150757