Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
MYSQL: Cannot set root pass
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
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Thu May 27, 2004 12:29 pm    Post subject: MYSQL: Cannot set root pass Reply with quote

I'm trying to use this command after installing mysql-4.0.20 for the first time:

Code:
mysqladmin -u root -h myhost pass rootpass


and i get the folowing errors:

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



i have been running the:
Code:
mysql-install-db
and /etc/init.d/mysql start


So what am I doing wrong? I'm doing this on localhost.
Back to top
View user's profile Send private message
tumbak
Apprentice
Apprentice


Joined: 10 Jan 2004
Posts: 230
Location: supposedly Palestine

PostPosted: Thu May 27, 2004 1:10 pm    Post subject: Reply with quote

try passing the "-p" option and if it gives you the same error then you dont have the "root@localhost" account in the "mysql" table, try logging in with the username "mysql" and do
Code:
>>use mysql;
>>select * from user;

to see if you have the account.

edited 1 time.
_________________
less QQ more pewpew!
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Thu May 27, 2004 1:31 pm    Post subject: Reply with quote

well i get the same error using the "-p" command i guess.
it prompts me for the pass even if i have passed it in once.
Code:
mysqladmin -u root -h tuxserver -p rootpass


and "Using password" is now "YES" instead of "NO".

then i tried the other solution
Code:
mysql -u mysql
>>use mysql;


and get this error:
Code:
error 1044: Access denied for uder: '@localhost' to database 'mysql'


And if i do a show databases it only show the test database.. shouldn't I have a mysql databse also?
Back to top
View user's profile Send private message
memborg
Tux's lil' helper
Tux's lil' helper


Joined: 16 Jun 2003
Posts: 121
Location: Aalborg, Denmark

PostPosted: Thu May 27, 2004 2:00 pm    Post subject: Reply with quote

Found the solution... I just removed /var/lib/mysql/*
and ran the mysql_install_db command again.... now it worked...

thanx to this post :
https://forums.gentoo.org/viewtopic.php?t=84829
Back to top
View user's profile Send private message
fuqnbastard
n00b
n00b


Joined: 13 Apr 2004
Posts: 46

PostPosted: Tue Jul 06, 2004 8:02 am    Post subject: Reply with quote

ok, again, for dullards like myself:

1) stop mysql server
2) delete everything in /var/lib/mysql
3) run mysql_install_db
4) start mysql server
5) do the "mysqladmin -u root -h myhost pass" thing
Back to top
View user's profile Send private message
banadushi
n00b
n00b


Joined: 26 Jun 2003
Posts: 37
Location: San Antonio, TX USA Earth

PostPosted: Tue Jul 06, 2004 8:53 am    Post subject: Reply with quote

or you could start mysql skiping the grant tables so you don't loose any of your other privilages:

Code:
# mysqld_safe --skip-grant-tables


and then just connect and set your passwords for all root users:

Code:
# mysql
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
mysql> FLUSH PRIVILEGES;


then killall mysqld and then restart mysql. Since it was a new install it wouldn't matter, but for when morons (read: customers) forget their mysql root user password the above is invaluble.

I believe the issue you were having above is that you were setting the password for root@myhost when there was already a password setup for root@%. I would really recommend deleting the user root@% and just keeping root@localhost. There is no reason you need a remote user with all priveledges.
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