View previous topic :: View next topic |
Author |
Message |
jorgeSallum Apprentice
Joined: 15 Dec 2004 Posts: 161 Location: São Paulo/Brazil
|
Posted: Fri Jun 24, 2005 3:12 pm Post subject: [SOLVED] how to change mysql user administrator |
|
|
Hi folks,
I have to deal with a server in which mysql was already installed by someone else, and strangely I have mysql access only by a non-root user. I tried to clean it and emerge it again unsuccessfully. How can I change it in order to have access by root user?
Thanks, J.
Last edited by jorgeSallum on Fri Jun 24, 2005 11:13 pm; edited 1 time in total |
|
Back to top |
|
|
juliuspc n00b
Joined: 06 May 2005 Posts: 14 Location: Canada
|
Posted: Fri Jun 24, 2005 4:11 pm Post subject: some questions |
|
|
What did you mean by "clean"? Was it the cleaning or the re-emerging that was unsuccessful? Did you get an error message?
Do you have databases and user prvileges on the system that you need to preserve? Can you take them offline or no? _________________ --
Julius
living under a rock
JuliusPC consulting
discover fantastic shops |
|
Back to top |
|
|
jorgeSallum Apprentice
Joined: 15 Dec 2004 Posts: 161 Location: São Paulo/Brazil
|
Posted: Fri Jun 24, 2005 4:58 pm Post subject: |
|
|
Thanks Juliuspc,
I take mysql off with "emerge -c mysql" and reemerge it and everything is ok despite the fact that I'm not able to connect with root (mysql -u root), but only with other user (mysql -u jose). The message error is...
Quote: | ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO) |
|
|
Back to top |
|
|
kashani Advocate
Joined: 02 Sep 2002 Posts: 2032 Location: San Francisco
|
Posted: Fri Jun 24, 2005 6:12 pm Post subject: |
|
|
It's a bit more complicated than that. First off root is not a priviledged account in Mysql. It's merely what most people designate as the admin account in Mysql. You can also have multiple admin accounts by handing out the proper privileges. In your case it's likely that the admin account is not the root account or that it needs a password you don't have.
Does your non root account have Y,Y,Y,Y privileges across the board in mysql.user? If so it's an admin account.
In order to gain access to Mysql you would need to remove /var/lib/mysql/mysql/ where all the access is stored. I'd stop Mysql, move that dir to some where else, start Mysql, and then run the script it'll tell you to in order to setup the db.
kashani _________________ Will personally fix your server in exchange for motorcycle related shop tools in good shape. |
|
Back to top |
|
|
juliuspc n00b
Joined: 06 May 2005 Posts: 14 Location: Canada
|
Posted: Fri Jun 24, 2005 6:12 pm Post subject: the bulldozer solution |
|
|
If you don't need the databases and user privileges already on the server, then you can do this:
Stop the MySQL server:
Code: | /etc/init.d/mysql stop |
Wipe out MySQL's database (including the encrypted root password):
Code: | rm -rf /var/lib/mysql/mysql |
Restore MySQL's database:
Code: | /usr/bin/mysql_install_db |
The output of that command will tell you to:
Start the MySQL server:
Code: | /etc/init.d/mysql start |
Quote: |
Code: | /usr/bin/mysqladmin -u root password 'new-password' |
Code: | /usr/bin/mysqladmin -u root -h sobe password 'new-password' |
See the manual for more instructions.
|
On second thought, you should be able to leave out the above step "Wipe out MySQL's database:". Maybe mysql_install_db can restore the MySQL internal database while leaving anything else you've got in there intact.
Good luck. _________________ --
Julius
living under a rock
JuliusPC consulting
discover fantastic shops |
|
Back to top |
|
|
jorgeSallum Apprentice
Joined: 15 Dec 2004 Posts: 161 Location: São Paulo/Brazil
|
Posted: Fri Jun 24, 2005 11:12 pm Post subject: |
|
|
Thanks Julius, it's running perfect now. |
|
Back to top |
|
|
|