Categories
Linux UNIX

MySQL – Backup & Restore A Database

Dump all databases mysqldump -u <USERNAME> -p<PASSWORD> –all-databases > alldatabases.sql Dump Multiple/Specific Databases mysqldump -u <USERNAME> -p<PASSWORD> -databases db_name1 [db_name2 …] > alldatabases.sql Dump (Backup) A Single Database mysqldump -u <USERNAME> -p<PASSWORD> <DATABASE_NAME> > <DATABASE_NAME>.sql Restore A Single Database mysql -u <USERNAME> -p<PASSWORD> <DATABASE_NAME> < <DATABASE_NAME>.sql

Categories
Linux UNIX

Reset Root MySQL Password

Error $ mysql -u root Error 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: NO) Stop mysqld deamons $ sudo service mysql stop Start a mysql deamon with the –skip-grant-table option $ sudo mysqld_safe –skip-grant-tables Open a┬áseparate┬áterminal and and run the following commands $ mysql mysql> use mysql; mysql> UPDATE user SET password=PASSWORD(‘YOUR_NEW_PASSWORD_HERE’) WHERE […]