LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-11-2014, 04:41 AM   #1
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Rep: Reputation: Disabled
reset mysql password


I have a server ( live ) which have mysql database , I forget mysql root password , could advise if it is possible to copy the db to other server ( testing ) and then set root password ? as I would not to change live server mysql root password.

thanks
 
Old 04-11-2014, 04:50 AM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,236

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
You can copy the physical files but you will have to stop your live MySQL instance during the copy process.

Then you can experiment with the recommended root reset procedure on your copy.
 
Old 04-11-2014, 04:55 AM   #3
DinoFly
Member
 
Registered: Nov 2007
Distribution: Fedora, CentOS,
Posts: 72

Rep: Reputation: Disabled
First stop your mysql server, than start it with option --skip-grant-tables

Code:
#mysqld_safe --skip-grant-tables
than login with user root:

Code:
#mysql --user=root mysql
and update the grant tables on mysql with your new password:

Code:
update user set Password=PASSWORD('new-password') where user='root';
flush privileges;
exit;
than just restart mysql server and you are good to go.

Here is an howto that describes the whole proces:
http://www.howtoforge.com/reset-forg...-root-password
 
Old 04-11-2014, 05:36 AM   #4
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Original Poster
Rep: Reputation: Disabled
One more question , if I have 3 mysql databases in a server , could it set to individual password for each mysql db ? thanks
 
Old 04-11-2014, 05:40 AM   #5
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 2,236

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
You can create as many users as you wish within MySQL.

Each user can have their own password and can have their own permissions on different databases.

I have a server that has 18 different databases for different websites, each of those websites has their own username/password/permissions. One of those websites has three databases and the user has permissions on all three of them. I also have other usernames with different permissions for replication and for backup.

If your next question is "how do I do this" then start another thread rather than having two different questions in the same thread.
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to reset MYSQL password prashansa Linux - Newbie 2 08-08-2012 08:27 AM
unblable to reset password for mysql Gil@LQ Linux - Server 1 04-13-2012 04:46 AM
Mysql password reset etch the_Case Debian 11 05-30-2007 05:08 AM
mysql root password reset. gtum5 LinuxQuestions.org Member Intro 0 03-08-2007 09:57 PM
MySQL - Canot reset password texmansru47 Linux - Software 1 10-10-2005 06:19 PM


All times are GMT -5. The time now is 06:05 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration