November
19
MySQL: migration
- This is an example of how I did it. It is not exhaustive, but close.
On the old server:
Dump the needed Databases:
mysqldump -u root -p dbname1 > dbname1.dump
mysqldump -u root -p dbname2 > dbname2.dump
mysqldump -u root -p dbname3 > dbname3.dump
On the new server:
Download mysql from Oracle and unzip it:
unzip p26976024_570_Linux-x86-64.zip
tar -zxvf mysql-commercial-5.7.20-1.1.el7.x86_64.repo.tar.gz
cd mysql-5.7/
cd 5.7.20/
If installing on Red Hat check to make certain mariadb is uninstalled:
yum remove mariadb*
Install the mysql rpms:
rpm -ivh mysql-commercial-common-5.7.20-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-*
rpm -ivh mysql-commercial-libs-5.7.20-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-libs-compat-5.7.20-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-client-5.7.20-1.1.el7.x86_64.rpm
rpm -ivh mysql-commercial-server-5.7.20-1.1.el7.x86_64.rpm
systemctl start mysqld.service
systemctl status mysqld.service
grep 'temporary password' /var/log/mysqld.log
systemctl enable mysqld.service
mysql -u root -p
systemctl restart mysqld
nano /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
innodb_data_file_path = ibdata1:10M:autoextend
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
validate_password_policy=LOW
#configurations for agileapps
sql-mode="PIPES_AS_CONCAT,ANSI_QUOTES"
character-set-server=utf8
collation-server=utf8_general_ci
max_allowed_packet = 8M
mysql -u root -p
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p mysql
systemctl restart mysqld
systemctl status firewalld.service
systemctl disable firewalld.service
systemctl stop firewalld.service
hostnamectl set-hostname servername
reboot
mysql -u root -p
mysql> create database dbname1;
mysql> use dbname1;
mysql> source dbname1.dump;
mysql> create database dbname2;
mysql> use dbname2;
mysql> source dbname2.dump;mysql>
create database dbname3;
mysql> use dbname3;
mysql> source dbname3.dump;