LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   mysql root password lost (http://www.linuxquestions.org/questions/linux-software-2/mysql-root-password-lost-337300/)

nazir 06-26-2005 10:30 AM

mysql root password lost
 
Does anyone know how to change mysql's root password?

acid_kewpie 06-26-2005 01:45 PM

yep, there's loads of people that know... did you try google first?

http://openskills.info/infobox.php?ID=1033
http://wiki.wonder.pl/index.php/Mysq...oot%20password
http://www.perturb.org/display/entry/533/
http://www.siliconvalleyccie.com/lin...#_Toc105342544

nazir 06-26-2005 02:01 PM

yes, i should try google first, but i was tired looking for some other things
sorry and thanks for help

ps2cho 07-15-2005 12:33 PM

Im having this problem and i cant get it to reset.
Iv tried everything on these webpages...Iv tried all three approaches.


-----------------------
server ~ # safe_mysqld --skip-grant-tables &
[1] 10432
server ~ # -bash: safe_mysqld: command not found


----------------------------------


server ~ # /usr/libexec/mysqld -Sg --user=root &
[1] 10433
server ~ # -bash: /usr/libexec/mysqld: No such file or directory


---------------------------------

server ~ # mysqld --skip-grant-tables

This one doesnt even say anything. It just stops.

DragonM15 10-08-2007 03:20 PM

Quote:

Originally Posted by ps2cho (Post 1748555)
Im having this problem and i cant get it to reset.
Iv tried everything on these webpages...Iv tried all three approaches.


-----------------------
server ~ # safe_mysqld --skip-grant-tables &
[1] 10432
server ~ # -bash: safe_mysqld: command not found


----------------------------------


server ~ # /usr/libexec/mysqld -Sg --user=root &
[1] 10433
server ~ # -bash: /usr/libexec/mysqld: No such file or directory


---------------------------------

server ~ # mysqld --skip-grant-tables

This one doesnt even say anything. It just stops.

What OS are you running? Try 'whereis mysqld' that will give you the location of mysqld... also if you are running slackware, I know there is a script to start the daemon via '/etc/rc.d/rc.mysqld start' Just some thoughts.

DragonM15

telakenesys 10-09-2007 09:54 AM

I had the same problem to this I think before. Correct me if I am wrong. You have lost root access to MySQL.

What I ended up doing was to delete the 'mysql' (contains all users and passwords and access) database files and run mysql_install_db

Make sure that you backup first.

This will recreate the 'mysql' database and setup root with no password. This will also delete any access you have currently set for any other users and databases.

This worked for me, hope it is what you are after.

DragonM15 10-09-2007 11:18 AM

I fixed this problem by putting the line:
Code:

SET PASSWORD FOR 'root'@'localhost' = PASSWORD('ThePasswordyouwantforrootaccount');
in a random file, say mysqlpasswordreset

Then running the command mysql_safe --init-file=/pathtopasswordreset/mysqlpasswordreset

This helped me out, I hope it works for others as well.

Later,
DragonM15


All times are GMT -5. The time now is 07:57 AM.