LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   change mysql username and password on ec2 lamp (https://www.linuxquestions.org/questions/linux-newbie-8/change-mysql-username-and-password-on-ec2-lamp-935379/)

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;
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

ggalan 04-04-2012 02:27 PM

i keep getting
Code:

command not found

ggalan 04-04-2012 02:44 PM

i thought this would work
Quote:

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.