?
Solved

Mysql login from root user without password

Posted on 2009-02-14
2
Medium Priority
?
1,480 Views
Last Modified: 2012-05-06
I have installed Mysq 5.0.67l on a Linux FEdora 10 box, and all is working well except one thing.  I should be able to login without specifying any password as long as I am logged into the Linux box as "root" and, in fact, it was this way when I first got the install up and running.  I have imported many databases (via mysqldump) from other systems, and now I can no longer log in without a password when logged in as "root".


0
Comment
Question by:rboudrie
2 Comments
 
LVL 2

Accepted Solution

by:
RickSanson earned 1000 total points
ID: 23641277
Two ways...

Don't define the root password for MySQL


         To use SET PASSWORD on Unix,
do         this:        shell> mysql -u root
mysql> SET PASSWORD FOR ''@'localhost' = PASSWORD('newpwd');
mysql> SET PASSWORD FOR ''@'host_name' = PASSWORD('newpwd');

With newpwd net defined, no spaces or anything.

See this for more: http://dev.mysql.com/doc/refman/4.1/en/default-privileges.html


Or

create a .my.cnf file in your home (root) directory and put these line in it:

[client]
user=root
password=thepassword

You can login to mysql via command line by typing mysql.  

So that only root can read this file chmod it to 600:
chmod 600 .my.cnf

0
 

Author Closing Comment

by:rboudrie
ID: 31546917
Thanks
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month17 days, 6 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question