Junyangz's docs
  • Introduction
  • Ops
    • Linux-tips
    • MySQL-5.7.20
    • Upgrading MySQL
    • Upgrade OpenSSH to 7.7p1 in CentOS 6
    • Linux PERSISTENT NAMING
    • Use Kafka with Flume - CRS2
    • Setup Chroot SFTP in CentOS
    • Setup software RAID-5 in CentOS
    • SSH-port-forwarding
    • Elasticsearch In Production
    • ELK-simple-tutorial
    • Ansible Playbooks for Apache Kafka in production
    • GitHub Actions depoly Hexo
    • Test HTTP3/QUIC docker
    • Docker tutorial
    • SFTP-auth-pubkey
    • Linux Process Substitution
  • Note
    • Interview
      • interview-prepare
      • 2020-campus-recruiting
    • Android Tips
    • MacOS tips
    • Secret knowledge
    • GPG-Note
    • ud185
    • ud185-2
    • Introducing Tensorflow Federated
    • Tensorflow Federated
    • Expert Python Programing
    • What happens when zh_CN
    • TILGC
    • VScode keyboard shortcuts
    • Abseil Python
    • Latex Note
    • Git Cheatsheet
    • Study Smarter Not Harder
    • Machine Learning Interviews
    • 深度学习中的优化
    • Beej's Guide to Network Programming Note
      • ch4
      • ch5
      • ch6
      • ch7
  • [Share]
    • What to do after what to do
    • Truman is everywhere
    • Way2outer
    • 未来十五年
  • Quote
Powered by GitBook
On this page
  • Installing MySQL from Source
  • Backup old MySQL
  • Replace the binaries
  • Set MySQL PATH
  • Check and Upgrade MySQL Tables
  • Reference

Was this helpful?

  1. Ops

Upgrading MySQL

Upgrade from MySQL 5.6 to 5.7

Last edited by Junyangz AT 2018-05-18 19:44:46

If you plan to to upgrade using the data directory from your existing:

  1. MySQL installation:

  2. Stop the old (MySQL 5.6) server

  3. Upgrade the MySQL binaries in place (replace the old binaries with the new ones)

  4. Start the MySQL 5.7 server normally (no special options)

  5. Run mysql_upgrade to upgrade the system tables

  6. Restart the MySQL 5.7 server

Installing MySQL from Source

# refer MySQL-5.7 installation-tutorial.

Backup old MySQL

#tar zcvf mysql.tar.gz /usr/local/mysql
service mysqld stop
cd /usr/local/
mv mysql mysql5.6

Replace the binaries

#mv /usr/local/mysql-5.7.19 /usr/local/mysql
#ln -s  /usr/local/mysql/bin /usr/local/bin/
#unlink /usr/local/mysql
ln -s mysql-5.7.19/ mysql
chown -R mysql:mysql mysql-5.7.19/
chown -R mysql:mysql mysql
# copy init.d file
cp mysql/support-files/mysql.server  /etc/init.d/mysqld

Set MySQL PATH

vim /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin

source /etc/profile
#echo $MYSQL_HOME

Check and Upgrade MySQL Tables

service mysqld start
mysql/bin/mysql_upgrade -uroot -p -S /data2/mysql5.6/run/mysql.sock

mysql -uroot -p
show databases;
#database sys is MySQL5.7 new add.
#service mysqld restart

Reference

PreviousMySQL-5.7.20NextUpgrade OpenSSH to 7.7p1 in CentOS 6

Last updated 2 years ago

Was this helpful?

MySQL Upgrade Strategies
mysql_upgrade
MySQL 5.6升级至MySQL 5.7--------版本升级最佳实战
MySQL从5.6升级到5.7的多种实战经验总结
记录一次MySQL升级的运维实践