First, set the change root password
Start MySQL
/usr/local/mysql/bin/mysql-uroot
Error
VI my.cnf inside the socket path changed to/tmp/mysql.sock, and made a soft link: ln-s/tmp/mysql.sock/var/lib/mysql/mysql.sock after normal
Change environment variable path, add MySQL absolute path
Mysqladmin-uroot password ' mimA123 '
mysql-uroot-pmima123 Use the-P command with a password to enter the
Password reset
vi/etc/my.cnf//Increase Skip-grant
Restart MySQL service/etc/init.d/mysqld restart
Mysql-uroot
Use MySQL;
The password is an encrypted string
Update user set Password=password (' mimA123 ') where user= ' root ';
Second, connect MySQL
Mysql-uroot-pmima123
mysql-uroot-pmima123-h127.0.0.1-p3306
Mysql-uroot-pmima123-s/tmp/mysql.sock
Mysql-uroot-pmima123-e "Show Databases"
Third, MySQL common commands
Query library show databases;
Switch the library use MySQL;
View the table in the library show tables;
View the fields in the table desc user;
View Build Table statement Show create TABLE user\g;
View the current user Select User ();
View the database currently in use Select Databsase ();
Creating a library Create database db1;
CREATE table use DB1; CREATE TABLE T1 (' id ' int (4), ' name ' char (40));
View current database version select version ();
View database status Show status;
View each parameter show variables; Show variables like ' max_connect% ';
Modify parameter set global max_connect_errors=1000;
View queue show Processlist; Show full processlist;
Linux centosvmware MySQL Common operation settings change root password, connect MySQL, mysql common command