WDCP控制面板升级mysql为5.7.11的方法

时间:2022-06-01 18:37:51

1、下载解压

下载地址为:http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz


tar -xvf mysql-5.7.11-linux-glibc2.5-x86_64.tar
得到mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz mysql-test-5.7.11-linux-glibc2.5-x86_64.tar.gz
tar -zxvf mysql-5.7.11-linux-glibc2.5-x86_64.tar.gz
tar -zxvf mysql-test-5.7.11-linux-glibc2.5-x86_64.tar.gz
------------------------

2、备份
mysqldump -uroot -p"Bgichina1&test" db_wegram > db_wegram_test.dump
mysqldump -uroot -p"Bgichina1&test" wdcpdb > wdcpdb_test.dump

-------------------------------------------
ps -ax | grep mysql
warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
620 pts/0 D+ 0:00 grep mysql
1066 ? S 0:00 /bin/sh /www/wdlinux/mysql-5.1.69/bin/mysqld_safe --datadir=/www/wdlinux/mysql-5.1.69/var --pid-file=/www/wdlinux/mysql-5.1.69/var/10-4-35-234.pid
1254 ? Sl 10:46 /www/wdlinux/mysql-5.1.69/libexec/mysqld --basedir=/www/wdlinux/mysql-5.1.69 --datadir=/www/wdlinux/mysql-5.1.69/var --user=mysql --log-error=/www/wdlinux/mysql-5.1.69/var/10-4-35-234.err --pid-file=/www/wdlinux/mysql-5.1.69/var/10-4-35-234.pid --socket=/tmp/mysql.sock --port=3306
---------------------------------------------------------------
mv mysql-5.7.11 /www/wdlinux/
关闭数据库
cd /www/wdlinux
cd init.d
[root@10-4-35-234 init.d]# ./mysqld stop
Shutting down MySQL. SUCCESS!


mysql_upgrade -uroot -p"Bgichina1&test"
cp mysqld mysqld~

cd /www/wdlinux/etc
cp my.cnf my~.cnf

cd /www/wdlinux/
mv mysql mysql~

cd mysql-5.7.11
mkdir var
chown -R mysql var
-----------------------------------
软连接
ln -s mysql-5.7.11 mysql

编辑/www/wdlinux/etc/my.cnf

[mysqld]


#-----------------------------------
#added by musictom
early-plugin-load=""
datadir=/www/wdlinux/mysql-5.7.11/var
basedir=/www/wdlinux/mysql-5.7.11
user=root

character-set-server=utf8mb4

collation_server=utf8mb4_unicode_ci

character-set-client-handshake = FALSE

init_connect='SET NAMES utf8mb4'

#
#-----------------------------------
注释thread_concurrency
#thread_concurrency = 8

------------------------------------

[mysql]

#-------------------------------

#added by musictom

default-character-set = utf8mb4

#-------------------------------


初始化数据库
mysqld --basedir=/www/wdlinux/mysql-5.7.11 --user=mysql --datadir=/www/wdlinux/mysql-5.7.11/var --initialize
生成的root初始密码为"IWse#l?eh6#1"

[Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-04-13T02:46:02.891041Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-04-13T02:46:03.137034Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-04-13T02:46:03.201517Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: dcd726b9-0121-11e6-9763-525400b32df6.
2016-04-13T02:46:03.202687Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-04-13T02:46:03.203686Z 1 [Note] A temporary password is generated for root@localhost: IWse#l?eh6#1

--------------------------------------
启动数据库
cd /www/wdlinux/init.d
./mysqld start
Starting MySQL. SUCCESS!


---------------------------------------
修改root密码
mysqladmin -u root -p"IWse#l?eh6#1" password "Bgichina1&test"

mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.
---------------------------------------
还原数据库
mysql -uroot -p"Bgichina1&test"
create database db_wegram;
create database wdcpdb;


mysql -uroot -p"Bgichina1&test" db_wegram < db_wegram_test.dump
mysql -uroot -p"Bgichina1&test" wdcpdb < wdcpdb_test.dump


-----------------------------------------
修改表的charset
alter table chat_message CHARSET=utf8mb4;
alter table chat_message CHANGE content content VARCHAR(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;

-----------------------------------------
解决“无法连接mysql,请检查mysql是否已启动及用户密码是否设置正确!:”的问题
在phpmyadmin里添加用户wdcp@localhost
点击localhost>>wdcpdb>>点右侧的人行图标,提示“检查数据库wdcpdb的权限”
点下方的“添加新用户”按钮
密码输入abcd1234
用户数据库的选项选择“授予数据库“wdcpdb”的所有权限。”,然后保存
密码还可以修改的

WDCP控制面板升级mysql为5.7.11的方法

WDCP控制面板升级mysql为5.7.11的方法

WDCP控制面板升级mysql为5.7.11的方法

然后cd /www/wdlinux/wdcp/data
vim db.inc.php
$dbuser='wdcp';
$dbpw='abcd1234';
保存就可以了,注意如果注释行的话用//而不是#,不然有可能会让wdcp面板出现白板