How to log in to MySQL server without password

Danlucy

Well-known member
Registered
Joined
Oct 12, 2014
Messages
86
Points
8
Is there a way to config Mysql root user to allow me log into Mysql console without typing a password?
I feel tired when I have to type mysql root password to login Mysql consolve each time, sometime I don't remember the password or changed hosting server and I must to find where it is set.

Thanks in advance.
Dan
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
Hi Danlucky,

Yes, you can do this by editing client section of the ~/.my.cnf file, and add the password there.

Create /root/.my.cnf and add the following to it, make sure the file has read permissions for root only. chmod 0600 ~/.my.cnf:

[client]
user=root
password=password


When running mysql from the command line as root you will no longer be asked for credentials.
 
Recommended Threads

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top