LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-16-2003, 09:41 AM   #1
spintrance7
LQ Newbie
 
Registered: Oct 2003
Posts: 9

Rep: Reputation: 0
Mysql root password


I just installed RedHat 9 console mode only. I got mysql service started and running but i dont know where to set the root password. Can you guys help?


thanks
 
Old 10-16-2003, 10:24 AM   #2
snerfu
Member
 
Registered: Sep 2003
Distribution: Debian/GNU
Posts: 30

Rep: Reputation: 15
mysqladmin -u root password 'new-password'
 
Old 10-19-2003, 03:39 PM   #3
noobist
LQ Newbie
 
Registered: Oct 2003
Location: UK
Distribution: Mandrake 10 / Windows XP Pro / Notorious linux dist. swapper :p
Posts: 10

Rep: Reputation: 0
what if you are stupid enough to forget your root password?

anyway to change it?

ive tried reinstalling in red hat 9, but it retains all the data (as you might expect).

i want to COMPLETELY reinstall it.. data passwords and all.

thanks in advance!
 
Old 10-20-2003, 10:02 AM   #4
snerfu
Member
 
Registered: Sep 2003
Distribution: Debian/GNU
Posts: 30

Rep: Reputation: 15
http://www.mysql.com/documentation/m...ng_permissions

If you have set a root password, but forgot what it was, you can set a new password with the following procedure:

1. Take down the mysqld server by sending a kill (not kill -9) to the mysqld server. The pid is stored in a `.pid' file, which is normally in the MySQL database directory:

shell> kill `cat /mysql-data-directory/hostname.pid`

You must be either the Unix root user or the same user mysqld runs as to do this.
2. Restart mysqld with the --skip-grant-tables option.
3. Set a new password with the mysqladmin password command:

shell> mysqladmin -u root password 'mynewpassword'

4. Now you can either stop mysqld and restart it normally, or just load the privilege tables with:

shell> mysqladmin -h hostname flush-privileges

5. After this, you should be able to connect using the new password.

Alternatively, you can set the new password using the mysql client:

1. Take down and restart mysqld with the --skip-grant-tables option as described above.
2. Connect to the mysqld server with:

shell> mysql -u root mysql

3. Issue the following commands in the mysql client:

mysql> UPDATE user SET Password=PASSWORD('mynewpassword')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;

4. After this, you should be able to connect using the new password.
5. You can now stop mysqld and restart it normally.
 
Old 10-20-2003, 05:40 PM   #5
noobist
LQ Newbie
 
Registered: Oct 2003
Location: UK
Distribution: Mandrake 10 / Windows XP Pro / Notorious linux dist. swapper :p
Posts: 10

Rep: Reputation: 0
there is no .pid file.. i killed mysql using gnomes process manager..

then followed the intructions but when i try to run the mysqladmin command it still denies me access (root@localhost using password: yes)

how do i start up mysql with the --skip-grant-tables option?
i have been saying "service mysqld start --skip-grant-tables"

but i dont think its working correctly!
.. sorry for being a pain
 
Old 10-21-2003, 08:12 AM   #6
snerfu
Member
 
Registered: Sep 2003
Distribution: Debian/GNU
Posts: 30

Rep: Reputation: 15
What I would do after stopping mysql is to run:

mysqld --skip-grant-tables &

Then I would do:

mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('mynewpassword')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;


Exit out after that, and you should then be able to:

mysqlshow -u root -p
 
Old 10-21-2003, 03:15 PM   #7
noobist
LQ Newbie
 
Registered: Oct 2003
Location: UK
Distribution: Mandrake 10 / Windows XP Pro / Notorious linux dist. swapper :p
Posts: 10

Rep: Reputation: 0
i got it!

thanks
 
Old 11-29-2003, 04:20 PM   #8
mikeshn
Member
 
Registered: Feb 2002
Posts: 586

Rep: Reputation: 30
I have the similar problem.

I had an account "mike" to mysql. But somehow I change the password. So now I have just one access to the system as root.
Trying to login to mysql as root with password and without password no success. Root password is: 123456.

What I'm doing wrong? I cannot connect to MYSQL as root.

[root@localhost init.d]# mysql -h localhost -u root -p
Enter password:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
[root@localhost init.d]# mysql -h localhost -u root
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
[root@localhost init.d]#
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: MySQL root password recovey Boby LinuxAnswers Discussion 1 02-19-2009 01:51 PM
mysql root password lost nazir Linux - Software 6 10-09-2007 10:18 AM
MySQL root password. bulzbb Linux - Newbie 2 03-11-2004 09:32 AM
Resetting MySQL root password b200306 Linux - Software 3 02-08-2004 03:21 PM
MYSQL root password forgotton jon_k Linux - Software 5 07-18-2003 08:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration