mysql installation login and exit

There are many mysql installation tutorials on the Internet, so I won't go into details here. Here are some settings after installing mysql.

1. After installation, start mysql after installing mysql in order

systemctl start mysql

2. Find the password behind root@localhost in /var/log/mysql.log.

3. Log in to mysql

mysql -u root -p 

Enter the password found in the log file to log in.

4. Modify the root user password (this step is necessary, otherwise the subsequent database operations cannot be performed)

set password for 'root'@'localhost' = password('123456');

5. Modify the root user's remote login permissions

 switch to mysql library

 use mysql;

Query root user information

select host,user from user where user='root';

Modify root configuration

update user set host = '%' where user = 'root' and host='localhost';

Authorize the user

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

make the configuration take effect

flush privileges;

 

Here you can log in remotely

Guess you like

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