Backup
- mkdir mysqlbk
- mysqldump ---all-databases --routines --events > ~/mysqlbk/mysql_backup.sql
- cp /etc/my.cnf ~/mysqlbk/my.cnf
- cp -R /etc/my.cnf.d/ ~/mysqlbk/etc_my.cnf.d/
- cp -R /var/lib/mysql/ ~/mysqlbk/var_lib_mysql/
- mysql -u -p
mysql> open mysql
mysql> SELECT User, Host FROM mysql.user; # list user and backup
Upgrade
- rpm -e --nodeps mysql57-community-release
- yum update -y
- rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023
- yum install -y https://repo.mysql.com/mysql84-community-release-el7-1.noarch.rpm
- yum makecache
- systemctl stop mysqld.service
- yum remove -y mysql-community-client-5.7* mysql-community-common-5.7* mysql-community-libs-5.7* mysql-community-server-5.7*
- yum install mysql-community-server
- systemctl start mysqld.service
ERROR:Data Dictionary initialization failed.
- rm -rf /var/lib/mysql
- mysqld --initialize --console
- chown -R mysql:mysql /var/lib/mysql
- systemctl start mysqld
Config
- grep 'temporary password' /var/log/mysqld.log
- mysql_secure_installation
沒有留言:
張貼留言