Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Root doesn't have access to MySQL Database?! [FIXED]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
macawgumbo
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 165

PostPosted: Sun Jan 16, 2005 9:41 pm    Post subject: Root doesn't have access to MySQL Database?! [FIXED] Reply with quote

Root is not able to connect to the MySQL database and I just installed it. How is that? There is no way to set the password for the mysql user it says invalid token authentication when doing passwd mysql. I can't change the root mysql password because root can't connect. ??

Last edited by macawgumbo on Sun Jan 16, 2005 10:51 pm; edited 1 time in total
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Sun Jan 16, 2005 9:56 pm    Post subject: Reply with quote

Hi.

You have emerge it. But have you setup the databases ?
And have you started the mysql ?

You don't have to set the password for mysql as it not a user.

Try this as root
Code:

mysql_install_db

Read the info produced after this command.

Then start the mysql
Code:
/etc/init.d/mysql start


Use mysqladmin to set the password for the databas root user.

(you may skip the line with the host in.
mysqladmin -u root -h $hostname password 'new-password'
as this use to fail becaus of othe setup isue)

Use this
mysqladmin -u root password 'new-password'

The only thing you should change in this line is the
'new-password', enter your password instead between the ' '.

Do not mix this user with the root user for your machin. They are not
the same the mysql is using it's own table for access control.

-Kjell
Back to top
View user's profile Send private message
macawgumbo
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 165

PostPosted: Sun Jan 16, 2005 10:04 pm    Post subject: Reply with quote

Code:
 error: 'Access denied for user: 'root@localhost' (Using password: NO)'
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Sun Jan 16, 2005 10:23 pm    Post subject: Reply with quote

OK.

Stop the database
Code:

/etc/init.d/mysql stop

remove the database mysql and test in
/var/lib/mysql

Rerun the script
Code:

/usr/bin/mysql_install_db

Start up the mysql and now try to connect as root.
(you don't need to be root user on your machine)
Code:

mysql -u root


If this connects then exit and run
Code:
mysqladmin -u root password 'new-password'


-Kjell
Back to top
View user's profile Send private message
macawgumbo
Apprentice
Apprentice


Joined: 28 May 2004
Posts: 165

PostPosted: Sun Jan 16, 2005 10:50 pm    Post subject: Reply with quote

It works. Thanks.

How do you make it prompt for password when you do a
Code:
mysql -u root
Back to top
View user's profile Send private message
keyson
l33t
l33t


Joined: 10 Jun 2003
Posts: 830
Location: Sweden

PostPosted: Sun Jan 16, 2005 10:55 pm    Post subject: Reply with quote

You can type
Code:

mysql -u root -p

then it ask for the password. But you have to set it befor that.
Code:

mysql -u root -ppassword

(OBS no space between the -p and password)
make it enter whitout asking.

-Kjell
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum