View previous topic :: View next topic |
Author |
Message |
memborg Tux's lil' helper
Joined: 16 Jun 2003 Posts: 121 Location: Aalborg, Denmark
|
Posted: Thu May 27, 2004 12:29 pm Post subject: MYSQL: Cannot set root pass |
|
|
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 |
|
|
tumbak Apprentice
Joined: 10 Jan 2004 Posts: 230 Location: supposedly Palestine
|
Posted: Thu May 27, 2004 1:10 pm Post subject: |
|
|
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 |
|
|
memborg Tux's lil' helper
Joined: 16 Jun 2003 Posts: 121 Location: Aalborg, Denmark
|
Posted: Thu May 27, 2004 1:31 pm Post subject: |
|
|
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 |
|
|
memborg Tux's lil' helper
Joined: 16 Jun 2003 Posts: 121 Location: Aalborg, Denmark
|
|
Back to top |
|
|
fuqnbastard n00b
Joined: 13 Apr 2004 Posts: 46
|
Posted: Tue Jul 06, 2004 8:02 am Post subject: |
|
|
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 |
|
|
banadushi n00b
Joined: 26 Jun 2003 Posts: 37 Location: San Antonio, TX USA Earth
|
Posted: Tue Jul 06, 2004 8:53 am Post subject: |
|
|
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 |
|
|
|