Summary of common mysql commands and summary of common mysql commands
Set and change the password of mysqlroot
The first time you enter the mysql database,
!
You can add the absolute mysql path to the environment variable,
You can also set boot loading,
Reload environment variables to make mysql take effect
Log on to mysql-uroot again.
Add a password to mysql
Log On again for verification,
Change Password
Login again for verification. Verification Successful
Reset the password, modify the configuration file, and skip authorization.
Restart the mysql service and use the root user to verify that no password is required.
Enter and modify the password file
update user set password=password('aminglinux') where user='root';
Modify my. conf after exiting
Delete the above authorization skipping File
Restart the mysqld service
Re-enter mysql Verification
Connect to mysql
Method 1: Use the tcpip Protocol ip: Port, applicable to remote ip, this example is the local machine Experiment
Method 2: Use socket (provided that sock is configured in my. conf), which is only applicable to the local machine.
Method 3: Use the command line, suitable for use with shell scripts
Mysql Common commands
Query databaseShow databases;
Switch DatabaseUse mysql;
View the table in the databaseShow tables;
View fields in the tableDesc tb_name;
View table creation statementsShow create table tb_name \ G;
View Current UserSelect user ();
View the currently used databaseSelect databsase ();
Create a databaseCreate database db1;
Create a tableUse db1; create table t1 (idInt (4 ),nameChar (40) ENGINE = InnoDB default charset = utf8;
Delete tableDrop table t1;
View the current database versionSelect version ();
View database statusShow status;
View ParametersShow variables; with show variables like 'max _ connect % ';
Modify parametersSet global max_connect_errors = 1000; you can also modify it in/etc/my. conf.
View queues show processlist; show full processlist;