亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MySQL5.5升級至5.7

發布時間:2020-06-09 08:33:15 來源:網絡 閱讀:4150 作者:蘇黎世1995 欄目:MySQL數據庫

一、準備工作

  1. 新的服務器(10.12.21.184),作為從庫
  2. 在21.184上下載MySQL5.6、5.7的最新穩定版本的二進制包
host role
10.12.21.120 master
10.12.21.184 slave

二、操作

1. 主從搭建
  1. xtrbackup全備(20.120)
  2. 根據全備在20.184上啟動新的5.5數據庫,作為20.120的從庫
  3. 啟動主從,等待從庫追上主庫
2. 升級從庫

1.解壓文件包

cd /data0/mysql_update
tar xf mysql-5.6.40-linux-glibc2.12-x86_64.tar.gz
cd /usr/local
ln -s /data0/mysql_upgrade/mysql-5.6.40-linux-glibc2.12-x86_64 mysql

2.添加環境變量

export PATH=/usr/local/mysql/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/mysql/lib:$LD_LIBRARY_PATH

3.修改配置5.6文件

cd /data0/mysql/config/
cp my.cnf my56.cnf
#修改basedir,并注釋該參數
# innodb_additional_mem_pool_size = 32M 從MySQL 5.6.3開始,   
#innodb_additional_mem_pool_size已被棄用,并將在未來的MySQL版本中刪除。
#table_cache=8192
#thread_concurrency=48
basedir=/usr/local/mysql/
plugin_dir=/usr/local/mysql/lib/plugin

新增:
skip-slave-start
sql_mode=''

4.關閉快速關機參數

[root@localhost (none)]>set global innodb_fast_shutdown=0;
Query OK, 0 rows affected (0.00 sec)

[root@localhost (none)]>show variables like 'innodb_fast_shutdown';
+----------------------+-------+
| Variable_name        | Value |
+----------------------+-------+
| innodb_fast_shutdown | 0     |
+----------------------+-------+
1 row in set (0.00 sec)

5.關閉從庫

[root@localhost local]# /data0/mysql/product/bin/mysqladmin --defaults-extra-file=/data0/mysql/config/user.root.cnf shutdown

6.啟動

[root@localhost local]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/config/my56.cnf &
[1] 9446
[root@localhost local]# 180605 15:37:12 mysqld_safe Logging to '/data0/mysql/mysqllog/logfile/mysqld.err'.
180605 15:37:12 mysqld_safe Starting mysqld daemon with databases from /data0/mysql/dbdata
  • 啟動的時候會出現大量如下報錯日志,不影響啟動,屬于正常現象
  • 是因為MySQL5.5和5.6的表結構不同
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'events_statements_summary_by_digest' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'users' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'accounts' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'hosts' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'socket_instances' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'socket_summary_by_instance' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'socket_summary_by_event_name' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'session_connect_attrs' has the wrong structure
2018-06-05 15:37:16 10312 [ERROR] Native table 'performance_schema'.'session_account_connect_attrs' has the wrong structure

7.升級5.6

/usr/local/mysql/bin/mysql_upgrade -S /data0/mysql/dbdata/mysql.sock -uroot -pXXXXX

8.關閉5.6的庫

[root@localhost local]# /usr/local/mysql/bin/mysqladmin
--defaults-extra-file=/data0/mysql/config/user.root.cnf shutdown

180605 16:02:30 mysqld_safe mysqld from pid file
/data0/mysql/dbdata/mysqld.pid ended
[1]+  Done                    /usr/local/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/config/my56.cnf

9.解壓MySQL5.7并建立軟連接

cd /usr/local/
[root@localhost local]# ln -s /data0/mysql_upgrade/mysql-5.7.22-linux-glibc2.12-x86_64 mysql

10.修改配置文件,啟動MySQL5.7

[root@localhost local]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/config/my57.cnf &
[1] 11262
[root@localhost local]# 2018-06-05T08:11:10.690409Z mysqld_safe Logging to '/data0/mysql/mysqllog/logfile/mysqld.err'.
2018-06-05T08:11:10.774997Z mysqld_safe Starting mysqld daemon with databases from /data0/mysql/dbdata
  • 出現如下報錯為正常現象
  • 原因是5.6與5.7的系統表結構不同

018-06-05T08:11:14.340649Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_current' has the wrong structure
2018-06-05T08:11:14.340681Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history' has the wrong structure
2018-06-05T08:11:14.340717Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_history_long' has the wrong structure
2018-06-05T08:11:14.340774Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_thread_by_event_name' has the wrong structure
2018-06-05T08:11:14.340828Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_account_by_event_name' has the wrong structure
2018-06-05T08:11:14.340869Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_user_by_event_name' has the wrong structure
2018-06-05T08:11:14.340911Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_by_host_by_event_name' has the wrong structure
2018-06-05T08:11:14.340948Z 0 [ERROR] Native table 'performance_schema'.'events_transactions_summary_global_by_event_name' has the wrong structure
2018-06-05T08:11:14.345136Z 0 [ERROR] Incorrect definition of table performance_schema.users: expected column 'USER' at position 0 to have type char(32), found type char(16).

11.升級5.7(時間較長,放在后臺)

 nohup /usr/local/mysql/bin/mysql_upgrade -S /data0/mysql/dbdata/mysql.sock -uroot -proot 2>&1 >/data0/mysql_upgrade/56to57.log &
www_fangdd_site.fdd_pats
Note     : TIME/TIMESTAMP/DATETIME columns of old format have been upgraded to the new format.
status   : OK

`cat`.`alteration`
Running  : ALTER TABLE `cat`.`alteration` FORCE
status   : OK
`cat`.`app_data_command_1`
Running  : ALTER TABLE `cat`.`app_data_command_1` FORCE
status   : OK

12.重啟MySQL5.7數據庫

[root@localhost mysql_upgrade]# /usr/local/mysql/bin/mysqladmin
--defaults-extra-file=/data0/mysql/config/user.root.cnf shutdown

[root@localhost mysql_upgrade]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/config/my57.cnf &
三、升級后需要注意的問題

1.sql_mode
MySQL5.7默認為下列sql_mode,為避免以前語句不規范帶來的隱患,將sql_mode設置為''

sql_mode                 | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

琼结县| 化德县| 金山区| 白玉县| 梧州市| 保亭| 瓮安县| 绥江县| 巴马| 自治县| 玛沁县| 措美县| 山阳县| 桃园县| 凤山市| 平山县| 江油市| 桐庐县| 澎湖县| 保定市| 丰台区| 通许县| 久治县| 南投县| 廊坊市| 盘锦市| 黔东| 宽甸| 洛阳市| 呼玛县| 涿鹿县| 吉安县| 科技| 康乐县| 汨罗市| 临城县| 重庆市| 荥经县| 安达市| 赤城县| 习水县|