Difference between revisions of "Mysql notes"
m (→Links) |
|||
Line 3: | Line 3: | ||
* [http://www.nparikh.org/unix/mysql.php Mysql Cheat-sheet] |
* [http://www.nparikh.org/unix/mysql.php Mysql Cheat-sheet] |
||
* [http://diveintomark.org/archives/2007/11/11/installing-mysql-on-ubuntu no-nonsense mysql installation guide...] :-) |
* [http://diveintomark.org/archives/2007/11/11/installing-mysql-on-ubuntu no-nonsense mysql installation guide...] :-) |
||
== Backup a database == |
|||
You may want to log in mysql and do "show databases;" to see which to backup, then do it like this. |
|||
mysqldump -u root -p [databasename] > [backupfile.sql] |
|||
== Lost MySQL password? == |
== Lost MySQL password? == |
Revision as of 01:05, 31 December 2010
Links
Backup a database
You may want to log in mysql and do "show databases;" to see which to backup, then do it like this.
mysqldump -u root -p [databasename] > [backupfile.sql]
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