1

Possible Duplicate:
How do I change the password of the root user in MySQL?

I have root access to an ec2 instance, but I don't know what the mysql root password is, which I need. How would I either 1) find this? or 2) re-install mysql and give myself a root password?

Community
  • 1
  • 1
David542
  • 104,438
  • 178
  • 489
  • 842

1 Answers1

1
$ sudo service mysql stop
$ /usr/bin/mysqld_safe --skip-grant-tables &
mysql -h localhost
> use mysql
> update user set password = password('') where user = 'root' and host='localhost';
> quit
$ sudo service mysql start
$ mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
David542
  • 104,438
  • 178
  • 489
  • 842