Learning Mysql



Download 4.24 Mb.
View original pdf
Page338/366
Date04.08.2023
Size4.24 Mb.
#61806
1   ...   334   335   336   337   338   339   340   341   ...   366
Learning MySQL
Backups and Recovery


Re-Creating Damaged Grant Tables
If you cannot restore your mysql grants database from backup, you will need to create afresh one. With Windows, you can extract the mysql directory from the installation package and place it under the MySQL data directory.
Under Linux or Mac OS X, you can use the mysql_install_db script to regenerate the mysql database and the privilege tables in it. This is particularly handy if your mysql database has somehow become corrupted. Note that if the user table has to be created,
the root password for the server will be reset to the default value (blank).
If mysql_install_db isn’t already in your system path, you can generally find it in the
scripts directory under your MySQL installation directory. Run mysql_install_db the same way you ran it in Chapter 2. If you’re not sure how to run the script, try logging in as the system superuser and running it with no parameters mysql_install_db
or optionally with the user=mysql parameter so that MySQL is configured to run under the mysql system user account mysql_install_db --user=mysql
Resources
To learn more about backing up MySQL databases, seethe Database Backups section of the MySQL manual (http://dev.mysql.com/doc/mysql/en/backup.html).
Exercises
1. SQL dump files are often very large why is this generally not a cause for worry. Setup a weekly backup of all databases on your server. Fora production server, what time would you choose for your regular backups. How can you recover modifications that have been made to your data since the last dump. For an application where any loss of data is unacceptable, how would you choose the location of your binary logfile?
Exercises | 369




Download 4.24 Mb.

Share with your friends:
1   ...   334   335   336   337   338   339   340   341   ...   366




The database is protected by copyright ©ininet.org 2024
send message

    Main page