Under the INNODB engine, after mysql is upgraded, restore the original data folder

My current environment is Mac OS X 10.11, and MySQL is 5.6

. First of all, we need to make sure that the contents of the original data folder data of mysql are not lost. One thing to note
here is that several original databases are stored in the data folder, but Not only these database folders, but also ib_logfile0, ib_logfile1, ibdata1, these files must not be lost, because they store the table space mapping, if lost, start the service will recreate new files, but in When querying a table, it will prompt information such as xx table is not exist that does not exist in the table.


Then copy it to the newly installed or upgraded MySQL directory. By default, it will be in this location. Of course, you can also modify the datadir data path through my.cnf.


So basically, it was relatively simple last night. It has been restored, but one thing to note is the permissions. It may not be useful to start at
this time. Because of the folder permissions, the data files cannot be read. You need to authorize the execution of $ sudo chown


under the /usr/local/mysql folder -
R mysql .
$ sudo chown -R mysql data

After authorizing the mysql folder and the data folder, you can try to start the database. Try to start the database
through mysqld_safe in the ./bin folder. If it fails to start, check the error log.


By adding log-error=/usr/.....error log path location in my.cnf to check the possible reasons for the error at startup, and then analyze.







-----
If the log files ib-logfile0~... and other files are no longer available, or cannot be matched, you can try the following solutions
http://dba.stackexchange.com/questions/57120/recover-mysql-database-from -data-folder-without-ibdata1-from-ibd-files

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326870778&siteId=291194637