1. Command line login using the default 3306 port of MySQL:
Mysql-u root-p
2. Manage multiple MySQL on different ports via a TCP connection (note: This feature is only available for MySQL4.1 or later versions):
Mysql-u root-p--protocol=tcp--host=localhost--port=3307
3. Manage multiple MySQL on different ports via socket sockets:
Mysql-u root-p--socket=/tmp/mysql3307.sock
4. Manage multiple MySQL on different ports via port and IP:
Mysql-u root-p-P 3306-h 127.0.0.1
5. Repair the damaged table (the table to be repaired in this example is T_user):
Repair table T_user;
6. MySQL Changes the root password to sa123:
Mysqladmin-u root-p 123 Password sa123
7. Add a user test1 password to ABC, so that he can log on any host, and all databases have query, insert, modify, delete permissions.
First connect to MySQL with the root user, and then type the following command:
Grant Select,insert,update,delete on * * to [[email protected] '%][email protected] '%[/email] ' identified by ' ABC ';
8. Start from line No. 0 and take 3 lines:
SELECT * FROM student limit 0, 3;
9. View the current database encoding:
Show variables like ' character_set_database ';
10. Modify the database encoding (XXX is the database name):
ALTER DATABASE XXX CHARACTER SET UTF8;
MySQL Common command operation