-   Linux - Newbie (
-   -   change mysql username and password on ec2 lamp (

ggalan 03-19-2012 08:19 PM

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.

chrism01 03-19-2012 11:35 PM

Here's some code to list users & grants;

# call like this
./ <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

ggalan 04-04-2012 02:27 PM

i keep getting

command not found

ggalan 04-04-2012 02:44 PM

i thought this would work

sudo mysqladmin -u root -p ******* password ****
but i keep getting access denied for user 'root@localhost'

chrism01 04-04-2012 07:43 PM

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

All times are GMT -5. The time now is 02:38 AM.