LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 05-19-2004, 10:33 AM   #1
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Rep: Reputation: 15
Mysql Root Login


I just installed mysql with the rpm file and I can't seem to login as the root mysql user. Do I need to be logged in as the root computer user to login as the root mysql user or anything like that? I''ve tried uninstalling it and reinstalling it with no luck at all so any suggestions would be appreciated.
 
Old 05-19-2004, 12:30 PM   #2
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 416Reputation: 416Reputation: 416Reputation: 416Reputation: 416
Could you post how you are trying to log in and what the error messages are? You do NOT need to be logged into your machine as root as the MySQL root and the system root are two different things. Also, my understanding of rpm installation is that the root user does NOT have a password to begin with, so if you are trying to use one that may cause an error.

Basically you should be able to log in with this:

mysql -u root
 
Old 05-19-2004, 01:17 PM   #3
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
I have tried logging in with that and many other methods all come back with this error pretty much

ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
 
Old 05-19-2004, 02:01 PM   #4
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Ok you can try:

Admin user id: root
Default password: blank

The first task is to assign a password:

[prompt]$ mysqladmin -u root password 'new-password'

Note: the following SQL commands will also work:

mysql> USE mysql;
mysql> UPDATE user SET Password=PASSWORD('new-password') WHERE user='root';
mysql> FLUSH PRIVILEGES;


and then

mysql -h localhost -u root -ppassword

Hope Works..

___________________
r0oT
2004
 
Old 05-19-2004, 02:09 PM   #5
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
I tried doing that through mysqladmin and got the following error message
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user: 'root@localhost' (Using password: NO)'

Than I try to use the mysql database but I get this since im not logged in as root mysql user
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'

I've tried flushing privileges but I get this error
ERROR 1227: Access denied. You need the RELOAD privilege for this operation
 
Old 05-19-2004, 02:41 PM   #6
Gerardoj
Member
 
Registered: May 2003
Location: Somewhere over the Rainbow
Distribution: Slackware 9.x, Knoppix, Damn Small Linux, RedHat.
Posts: 465

Rep: Reputation: 30
Ok.. You can the do the procedure for resetting the root password is as follows:

1. Log on to your system as either the Unix root user or as the same user that the mysqld server runs as.
2. Locate the `.pid' file that contains the server's process ID. The exact location and name of this file depend on your distribution, hostname, and configuration. Common locations are: `/var/lib/mysql/', `/var/run/mysqld/', and `/usr/local/mysql/data/'. Generally, the filename has the extension of `.pid' and begins with either `mysqld' or your system's hostname. Now you can stop the MySQL server by sending a normal kill (not kill -9) to the mysqld process, using the name of the `.pid' file in the following command:

shell> kill `cat /mysql-data-directory/host_name.pid`

Note the use of backticks rather than forward quotes with the cat command; these cause the output of cat to be substituted into the kill command.
3. Restart the MySQL server with the special --skip-grant-tables option:

shell> mysqld_safe --skip-grant-tables &

4. Set a new password for the root@localhost MySQL account:

shell> mysqladmin -u root flush-privileges password "newpwd"

Replace ``newpwd'' with the actual root password that you want to use.
5. You should now be able to connect using the new password.

hope works..
 
Old 05-27-2004, 09:23 AM   #7
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
I did the above and it didn't seem to work. So I tried some other things mainly uninstalling the rpm and trying to get the binary to work but I must of messed something up . Now my mysql.sock seems to have gone missing and im wondering as how to replace it? Also I have reinstalled the rpm and I would of thought that the mysql.sock file would been remade if it was deleted but it apparently it wasn't. Any help would greatly be appreciated.
 
Old 05-28-2004, 07:28 AM   #8
MistressOfChaos
LQ Newbie
 
Registered: May 2004
Posts: 1

Rep: Reputation: 0
Usually what Gerardoj and Hangdog42 say works, but... do you have RH9? I had the same problem with it. No problems with 7.3 or Debian.

I first tried to log in as admin, succeeded but had no access to the databases.

Code:
root@rh9box:root# mysql -uadmin
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 3.23.58

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use mysql
ERROR 1044: Access denied for user: '@localhost' to database 'mysql'
So well I did what sould never be done:


Code:
rh9box:~$ cd /var/lib/mysql
rh9box:/var/lib/mysql$ mv mysql mysql.old
rh9box:/var/lib/mysql$ scp -r rh73box:/var/lib/mysql/mysql .
rh9box:/var/lib/mysql$ service mysqld stop
rh9box:/var/lib/mysql$ service mysqld start
And then I could log in with the password from my other box!

I think you can use instead of rh73box a Knoppix CD (there should be a mysql server in there, and so you can get the mysql directory and log in as root with no pw, as said before).
 
Old 05-29-2004, 05:57 PM   #9
SilentK
LQ Newbie
 
Registered: May 2004
Distribution: Gentoo
Posts: 24

Original Poster
Rep: Reputation: 15
Well I figured out what was wrong and fixed it. Apparently when I was uninstalling the rpm it wasn't deleting all the files. So I did a locate mysql and deleted all the files be hand and installed it from the binary version and it worked perfectly.
 
Old 05-29-2004, 08:03 PM   #10
rkef
Member
 
Registered: Mar 2004
Location: bursa
Posts: 110

Rep: Reputation: 15
In my experience, I've always had to use (minimally) 'mysql -u root -p' and then it prompts for a password. The line "error: 'Access denied for user: 'root@localhost' (Using password: NO)'" usually indicates that you're not supplying a password (even a blank password must be "supplied").

In my experience anyway .
 
Old 06-26-2004, 12:17 AM   #11
subnet_rx
Member
 
Registered: Oct 2001
Distribution: Ubuntu 9.10
Posts: 148

Rep: Reputation: 15
MySQL question

nt
 
Old 08-14-2004, 01:54 PM   #12
alar
Member
 
Registered: Sep 2003
Location: Canada
Distribution: CentOS 5.5, Ubuntu 10.04, Linux Mint 11 gnome 64 bit
Posts: 336

Rep: Reputation: 36
I had similar problems and just thought I could add my 2 worth.
Originally I had changed my host settings in
/usr/local/phpMyAdmin-2.6.0-rc1/config.inc.php
which I later discovered that I should keep the setting localhost instead of my hostname frodo.
But I did! have to change the authentication type in that file to http!

< $cfg['Servers'][$i]['auth_type'] = 'http'; // Authentication method (config, http or cookie based)?
---
> $cfg['Servers'][$i]['auth_type'] = 'config'; // Authentication method (config, http or cookie based)?

Still learning this PHP and MySql, just got phpMyAdmin up and running, but I haven't seen this solution posted here and it did help me!

Cheers,
alar

BTW: Just browsing the manual and found this:

5.5.8 Causes of Access denied Errors
http://dev.mysql.com/doc/mysql/en/Access_denied.html


Last edited by alar; 08-14-2004 at 08:00 PM.
 
  


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: still can't login after root password reset andredude Linux - Software 4 12-19-2014 07:30 PM
wrong login shell prevent root login cefs99 Linux - Security 4 05-31-2006 09:28 AM
Big problem changed root password for mysql can't login pls comment johnnydangerous Linux - Software 5 07-08-2005 02:22 AM
I have re-installed MK 9.2 but cannot login as user, login as root works. bobinglis Mandriva 2 02-22-2004 12:39 PM
can only login as root? user login doesnt work..? anyone? hacking_4_b33r Linux - General 1 02-06-2004 12:40 AM


All times are GMT -5. The time now is 02:19 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration