Set to change the root password, connect to mysql, mysql common commands

Set to change root password:

The default password is blank.

 

Set root password:

The known root password is to modify the root password of mysql:

If you forget your password, you can add the following line to vim /etc/my .cnf to ignore the authorization service and log in to mysql directly. After modifying the file, you need to restart mysql systemctl restart mariadb=restart the database

The following is to log in directly after modifying the file.

 

 Connect to mysql:

connect to local database

Specify the database to connect to remotely

Display all libraries after connecting to mysql

 

 

MySQL common commands:

show databases query has all the libraries

Switch the library use mysql mysql= this time is equal to the name of the library, the name can be modified

show tables; query the tables in the library

desc + (the name of the table); query the fields in the table

show create table (the name of the table)\G; View the statement that created the table

select user(); view the current user

select database(); View the currently used database

 

MySQL common commands:

create database (name of library) Create a library

create table (table name) (`id` int(4), `name` char(40)); backticks are required to create a table

show create table (table name)\G; View the format of the created table show=view

drop table (tablename); drop table drop=drop

select version(); View the current database version

show status; view the status of the database

 

View the parameters: show variables; View the specified parameters: show variables like 'max_connect%' ;

 

Modify parameters: set global max_connect_errors=1000 ;

 

View the queue: show processlist; View the queue in full: show full processlist ;

 

 

 

expand 


mysql5.7 root password change    http://www.apelearn.com/bbs/thread-7289-1-1.html
myisam and innodb engine comparison   http://www.pureweber.com/article/myisam-vs-innodb/
Detailed explanation of mysql configuration:  http://blog.linuxeye.com/379.html
mysql tuning:  http://www.aminglinux.com/bbs/thread-5758-1-1.html
personal mysql tuning experience shared by students :   http://www.apelearn.com/bbs/thread-11281-1-1.html

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325720429&siteId=291194637