Change root password for mysql

Adjusting User Authentication and Privileges in MySql

Before you try to get into your mysql server, you need to change the password of root user.

Then run this command:

The output will be something like this:

You can see that the root user does in fact authenticate using the auth_socket plugin, to change the authentication to password for the root user:

Change the 'password' for yours. After you run the command the output will be something like this:

Then, run FLUSH PRIVILEGES which tells the server to reload the grant tables and put your new changes into effect:

Check the authentication methods employed by each of your users again to confirm that root no longer authenticates using the auth_socket plugin:

Now the output is similar to this:

Now you can exit of mysql shell

create a new user

From there, create a new user and give it a strong password:

Then, grant your new user the appropriate privileges. For example, you could grant the user privileges to all tables within the database, as well as the power to add, change, and remove user privileges, with this command:

Following this, exit the MySQL shell:

Finally, test the MySQL configuration.

----------

Home

Linux

Notes

MicroLog

----------

© DarknessCode