Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
systems:mysql_database_administration [2016/08/27 23:14]
smayr [Backup]
systems:mysql_database_administration [2018/07/27 16:40] (current)
smayr [Restore a database]
Line 70: Line 70:
   For backup database   For backup database
   % mysqldump -u root -pPassword -P3309 --routines --no-data originaldb > "d:\dbwithnodata.sql"   % mysqldump -u root -pPassword -P3309 --routines --no-data originaldb > "d:\dbwithnodata.sql"
 +  
   For restoration of database   For restoration of database
   % mysql -u root -pPassword -P3309 newdb < "d:\dbwithnodata.sql"   % mysql -u root -pPassword -P3309 newdb < "d:\dbwithnodata.sql"
Line 84: Line 84:
 4. Better yet, use [[#Backup_a_database|phpMyAdmin to backup]] the database. 4. Better yet, use [[#Backup_a_database|phpMyAdmin to backup]] the database.
  
-==Resetting Root Password== +== Resetting Root Password == 
 +==== Windows ====
 The procedure under Windows ((MySQL Documentation, http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html)): The procedure under Windows ((MySQL Documentation, http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html)):
 * Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: Start Menu -> Control Panel -> Administrative Tools -> Services. Then find the MySQL service in the list, and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop. * Stop the MySQL server if it is running. For a server that is running as a Windows service, go to the Services manager: Start Menu -> Control Panel -> Administrative Tools -> Services. Then find the MySQL service in the list, and stop it. If your server is not running as a service, you may need to use the Task Manager to force it to stop.
Line 93: Line 93:
 * You should be able to connect using the new password. * You should be able to connect using the new password.
  
 +==== Linux ====
 +Run these commands:
 +<code bash>
 +$ service mysql stop
 +$ mysqld_safe --skip-grant-tables &
 +$ mysql -u root
 +
 +mysql> use mysql;
 +mysql> update user set authentication_string=PASSWORD("YOUR-NEW-ROOT-PASSWORD") where User='root';
 +mysql> flush privileges;
 +mysql> quit
 +
 +$ service mysql stop
 +$ service mysql start
 +$ mysql -u root -p
 +</code>
 +NOTE: Note: prior to MySQL 5.7 the column was called ''password'' instead of ''authentication_string''
 ==Using phpMyAdmin to Manage a Database== ==Using phpMyAdmin to Manage a Database==
 ===Quick Installation=== ===Quick Installation===
Line 131: Line 148:
 * Select compression: GZipped. * Select compression: GZipped.
 * Press <Go> button. This unpacks and runs the SQL statements stored in that gzipped file. * Press <Go> button. This unpacks and runs the SQL statements stored in that gzipped file.
 +* Include the following statement in an SQL file that has constraints and fails to import: <code sql>SET SESSION FOREIGN_KEY_CHECKS=0;</code>