当前位置:网站首页>MySQL version upgrade + data migration

MySQL version upgrade + data migration

2022-06-25 23:48:00 Delusion_ wangx

Recently, you need to store time types in the database that are accurate to milliseconds , however Mysql5.6 Later versions only support decimal seconds , And my Mysql The version is 5.5, So I started to upgrade my version .

Let's not talk about the whole process here , Say a few details

1、 There are several steps to install the database : download myql 、 initialization mysql( add to data Folder )、 Opening service 、 Login database 、 Operating the database . Most of the students forgot to open the service , When installing a new version of the database, remember to close the previous service and start a new service .

2、 Put your... Before updating data Folder backup , It contains database information , All the databases and database tables you build are in it . After the backup, it is the whole mysql Data deleted by mistake can also be found
image.png

3、mysql5.7 Previous versions my.ini The configuration file , and 5.7 Not anymore , If it needs to be configured, add one by yourself , But it doesn't affect , Don't listen to the various tutorials that you should first create your own installation my.ini file , This file has been added with possible errors , But if you don't add it, you won't make mistakes . Of course, the configuration needs to be changed in the later stage, and it doesn't take much trouble
5.5 Of , Yes my.ini.png

5.7 Of , No, my.ini, The normal operation .png

4、 After downloading the new version, there is no data file , Open a command prompt as an administrator , Enter the new version of bin Execute under directory mysqld --initialize-insecure --user=mysql It will generate a data Folder . Do not directly copy the previous data file , Even if it is copied, it cannot be used

5、 After installing the new version, migrate the previous database : Just shut down the database service 、 Before mysql Under the path data The database folder and ibdata1 Copy , Paste to new data Next, restart the service . This step needs to be covered ibdata1 file .( Copying database files is not enough ,ibdata1 It's a must , There are data and indexes of each table , Missing will cause the import to fail ) Be careful : Cover ibdata1 Back up files before , Otherwise, it cannot be restored after being overwritten .
image.png

原网站

版权声明
本文为[Delusion_ wangx]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/176/202206252055329175.html