LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-19-2012, 08:19 PM   #1
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Rep: Reputation: 0
change mysql username and password on ec2 lamp


i have a LAMP stack on EC2, installed phpmyadmin then removed it so i can use mysql workbench.


how do i go about changing the username and password for mysql?
also if i wanted to add a dev dB, how would i add a new user/pass for that?


i found some reference to this but the information i gathered was conflicting. the site is live and i dont want to bring it down.
 
Old 03-19-2012, 11:35 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
Here's some code to list users & grants;
Code:
# call like this
./check_mysql_grants.sh <mysqlroot passwd here>


# shell code is

mysql -u root -p${1} --batch --skip-column-names -e "SELECT user, host FROM user" mysql | sed 's,\t,"@",g;s,^,show grants for ",g;s,$,";,g;' | mysql -u root -p${1} --batch --skip-column-names | sed 's,$,;,g'
Cmds to create/drop user etc https://dev.mysql.com/doc/refman/5.0...eate-user.html
 
1 members found this post helpful.
Old 04-04-2012, 02:27 PM   #3
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
i keep getting
Code:
command not found
 
Old 04-04-2012, 02:44 PM   #4
ggalan
Member
 
Registered: Oct 2010
Posts: 57

Original Poster
Rep: Reputation: 0
i thought this would work
Quote:
sudo mysqladmin -u root -p ******* password ****
but i keep getting access denied for user 'root@localhost'

Last edited by ggalan; 04-04-2012 at 02:46 PM.
 
Old 04-04-2012, 07:43 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
WHICH command is not found?
For my example you only need the mysqlroot passwd, not the OS level root passwd.
 
  


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
[SOLVED] just installed mysql srver 5.1, but getting errors while creating username&password. imran042 Linux - Newbie 20 03-03-2012 12:27 PM
Password Required for PHP MySQL Call with LAMP OtagoHarbour Linux - Security 7 11-03-2011 08:20 AM
How to change username and password in Squint joms18 Linux - Newbie 1 01-28-2010 01:12 AM
Get/Change the username & password in a CUSTOM Ubuntu LiveCD tuxhats Ubuntu 0 10-18-2007 09:32 PM
Postfix, SASL with MySQL prompting for username and password acecomp Linux - Software 2 02-16-2005 02:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:31 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