Add a password to the Mysql account root

The default password of the root account of the newly installed Mysql is empty, which is very insecure. You need to add a password for the account

1. First log in with the root account

2. Select the mysql database, there is a user table in the mysql database to save the database account information

use mysql

3. Enter the command:

update user set password=password('密码') where user='root';

Don't forget to refresh the permissions:

flush privileges;

There are many tutorials for setting the root password of mysql on the Internet, but for the new version 5.7, it is found that there is no password column.

The new way to set the root password is: update mysql.user set authentication_string=password('new password') where user='root';

Or: set password for username@localhost = password('new password');

4. mysql password-free login

Add skip-grant-tables in [mysqld] in my.ini or my.cnf

Guess you like

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