has been using Navicat to operate the MySQL database, today suddenly want to try the DOS console to operate, special record their first use experience, if there are errors, but also look at the big boys pointing.
First open the console, Win+r key, enter CMD, determine
Input mysql-uroot-p123456
where root represents your user name, 123456 is your database password
If successful, the following interface appears
then enter show databases; (note the plural, and do not forget the semicolon), the name of your database appears,
After that, ues + the database name you want to manipulate, such as use
Next look at what tables the current database has, enter the command show tables; (also note the plural form and semicolon)
Next, you can perform SQL statement operations on the table, such as query operations,SELECT * from phonebook; ( semicolon!) Semicolon! Semicolon! Don't forget to add a semicolon after the SQL statement )
Finally, a few FAQs
1, Chinese can not display properly
WORKAROUND: Use the command show variables like ' char% '; view encoding
Use the command set character_set_results=gb2312;
This allows you to display the operation as normal.
2, the field is too many, DOS window display problem
Workaround: Add \g after the SQL statement to display the records in a stripe.
Working with MySQL database steps in the console and a few minor issues