LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-15-2003, 09:07 AM   #1
TraCe66
LQ Newbie
 
Registered: Jun 2003
Posts: 11

Rep: Reputation: 0
Lightbulb MySQL question


what should i do about this error...............

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

TraCe66
-----------------------------------------------
Something changes but somethings do not!!!
 
Old 07-15-2003, 09:11 AM   #2
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
You have set a root password on your MySQL server. Use mysqladmin -p to allow it to prompt you for your password.

man mysqladmin
 
Old 07-15-2003, 09:14 AM   #3
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
you can set a password for mysql by the following:

mysqladmin -u root -p password 'newpassord'
 
Old 07-15-2003, 09:27 AM   #4
TraCe66
LQ Newbie
 
Registered: Jun 2003
Posts: 11

Original Poster
Rep: Reputation: 0
Guy thanks a lot but there are more problems..........

[root@Sam7 mysql-standard-4.1.0-alpha-pc-linux-i686]# mysqladmin --password 'helives'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!


TraCe66
 
Old 07-15-2003, 10:05 AM   #5
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
hahahah, hmmm are you sure that mysql is even running. If your running RedHat do the following:
service mysqld restart

If your running Slackware do this:

safe_mysqld &

If your running anything else, um install redhat or slack, ... hehhe kidding. Try the Slack problem resolve on any other system.
 
Old 07-15-2003, 10:07 AM   #6
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
Problem #0: You are missing the '=' from your --password parameter.

Problem #1: MySQLd is not running. If the mysql.sock file doesn't exist, it means that the MySQL server is down.
try 'service mysql[d] start'
 
Old 07-15-2003, 10:09 AM   #7
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
Your not required to put the = in the paramater.

mysqladmin -u root -p password 'newpassord'

works just fine.
 
Old 07-15-2003, 10:11 AM   #8
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
Emence: Well, something is wrong with the --password line, otherwise our friend here wouldn't be getting the

Enter password:

prompt, right?
 
Old 07-15-2003, 10:14 AM   #9
emence
Member
 
Registered: Jun 2003
Location: Springfield, MO
Distribution: RedHat/Slackware
Posts: 81

Rep: Reputation: 15
Quote:
[root@Sam7 mysql-standard-4.1.0-alpha-pc-linux-i686]# mysqladmin --password 'helives'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
Looks to me like he got the Password Entry. But the command I put in also works for changing the password or creating a new one. I do it daily.
 
Old 07-15-2003, 10:43 AM   #10
bentz
Member
 
Registered: Mar 2003
Distribution: Fedora, Mac OSX
Posts: 362

Rep: Reputation: 30
Exactly! A program shouldn't prompt for a password if it was specified on the command line. Unless it was specified on the command line incorrectly, of course.

Also, the command for changing the password is
mysqladmin -u root --password=CURRENTPASSWORD password NEWPASSWORD
 
Old 07-15-2003, 11:41 AM   #11
TraCe66
LQ Newbie
 
Registered: Jun 2003
Posts: 11

Original Poster
Rep: Reputation: 0
Thankyou all of you... but my problem is not solved
i just installed MySQL in Redhat 9 and since the root password is blank...
how can i access the database???

TraCe66
 
Old 07-15-2003, 02:35 PM   #12
jimlaur
LQ Newbie
 
Registered: Jul 2003
Location: Wilmington, DE
Distribution: Debian
Posts: 6

Rep: Reputation: 0
I have been struggling with these and related issues myself for the last few days.
I found password issue confusing too.

When you first start there is no root password, you must set it.
Until you set it, no password is required, and setting one causes trouble.
What I believe is that you need to put the -p switch on a command line if you want to be promted for the password.
There are other ways for the program to get a password, though.
If a password is set, and you do not add the -p switch, the command will fail unless the command finds the password by the alternate route.
You should avoid passing the password in the clear on the command line.

There are config files that client programs search in a fixed order from general to specific. The final, user level, file is named ~/.my.cnf.
You can put a password there, but you need to be careful about who can read the file. This is really only satisfactory for the root.
Some of the file might look like:

[mysqladmin]
password=secret
user=root

If you set up the root .my.cnf this way, then when root runs mysqladmin, it will not require the -p switch. This assumes that the password is up to date of course.

There are some helpul articles, one of which is:
Getting Started with MySQL

In the end, I fear I will have to read most of the MySQL manual, which is on their website, and which is generally good.

I think a lot of my problems are about things which have become "obvious" to experienced MySQL users.

My goal was to learn whether I should make a long term commitment to using MySQL. There are obvious advantages, but there are risks too. Right now I am struggling with ODBC, but I think I will start a new thread for help with this.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 08:44 AM
MySQL question... kith Linux - General 3 03-06-2004 06:40 PM
MySQL Question NoBrains Linux - Software 2 03-01-2004 10:10 PM
MySQL question jISV Programming 3 09-06-2002 11:24 AM
MySQL question ascii2k Linux - General 1 03-27-2002 04:48 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration