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

Last updated