Difference between revisions of "Mysql notes"

From DiLab
Jump to: navigation, search
(New page: == Links == * [http://www.nparikh.org/unix/mysql.php Mysql Cheat-sheet])
 
Line 1: Line 1:

== Links ==
== Links ==


* [http://www.nparikh.org/unix/mysql.php Mysql Cheat-sheet]
* [http://www.nparikh.org/unix/mysql.php Mysql Cheat-sheet]


== Lost MySQL password? ==

By example: recreated mysql passwords for the wikiuser and mysql-root.
You can reset root password - stop mysql and start the daemon like this:

* reset mysql root password
sudo /etc/init.d/mysql stop
sudo mysqld --skip-grant-tables
mysql -u root
mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit
sudo mysqladmin shutdown -u root
sudo /etc/init.d/mysql start

* Change mysql wikiuser password
$ mysql -u root -p
mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASSWORD") where User='wikiuser';
mysql> flush privileges;
mysql> quit

Revision as of 11:36, 18 February 2009

Links


Lost MySQL password?

By example: recreated mysql passwords for the wikiuser and mysql-root. You can reset root password - stop mysql and start the daemon like this:

  • reset mysql root password
 sudo /etc/init.d/mysql stop
 sudo mysqld --skip-grant-tables
 mysql -u root 
 mysql> UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
 mysql> FLUSH PRIVILEGES; 
 mysql> exit
 sudo mysqladmin shutdown -u root
 sudo /etc/init.d/mysql start
  • Change mysql wikiuser password
 $ mysql -u root -p
 mysql> use mysql;
 mysql> update user set password=PASSWORD("NEWPASSWORD") where User='wikiuser';
 mysql> flush privileges;
 mysql> quit