Click here for "Safe Air Conditioner Repair and Proper Freon Recovery".

Installation of Debian 10 DiCE, database migration from Mysql5.x to Mysql8

1. Installing DiCE

Whenever the global IP is changed, which happens when the Internet is disconnected or the router is disconnected and rebooted, you need to access the dynamic DNS to notify the change of global IP. DiCE does that automatically for you.

1. 1 Download and install Dice

①Download
※postscript I am currently unable to connect to the Linux version of Dice download page on the Dice developer’s site.

# cd /usr/local/bin/
# wget http://www.hi-ho.ne.jp/cgi-bin/user/yoshihiro_e/download.cgi?p=diced019
# tar -xzvf diced019.tar.gz
#cd /usr/local/bin/DiCE

If the link to the above download site is broken, we have uploaded the file to our site, and you can do the following

# cd /usr/local/bin/
# wget https://korodes.com/downloads/diced01914.tar.gz
# tar -xzvf diced01914.tar.gz
#cd /usr/local/bin/DiCE

②DiCE settings.
The output characters of DiCE are garbled because of EUC.
To convert them to UTF-8, install nkf.

# apt-y install nkf

#To run the 32-bit software Dice on a 64-bit OS

# apt install lib32stdc++6

③Start DiCE

# cd /usr/local/bin/DiCE
# ./diced | nkf -uw

1. 2 Adding an Event

DNS service is VALUEDOMAIN

# ./diced | nkf -uw
: add

Please enter the DynamicDNS service name.
“?” to list the supported services
(P)Return

>VALUEDOMAIN
Please enter a domain name.
“?” to display the list of domains
(P)Return

><Domain Name>
Please enter a host name.
(P)Return
><host name>
Please enter your login user name    
(P)Return
><User Name>  ←User name registered in VALUEDOMAIN 

Please enter your login password.
(P)Return
><passwd>  ←Password to log in to VALVEDOMAIN
Enter the IP address to be registered
If left blank, the current IP address will be detected automatically.
(P)Return
>blank space

Please give this event a title.
(P)Return
>xxxxxxxxx(put something on randomly)
Specify the frequency of execution (enter a number)
(0)One time only (1)Once a day (2)Once a week (3)Once a month
(4)Other cycles (5)When IP address changes(6)startup (point in) time
(P)Return
>5
If you are in an environment where your IP address does not change often, your account may be deleted after a certain period of time without updating it.
If your IP address does not change often, your account may be deleted after a certain period of time without updating.
Please specify the interval to run when the IP address does not change.
(0)Every 7 days (1)Every 14 days (2)Every 21 days (3)Every 28 days
(4)Every 35 days (5)Every 56 days (6)Every 84 days
(P)Return
>0(decide arbitrarily)
Do you want to enable this event? (Y/N)
(Enabling/disabling the event can be switched by the “EN/DIS” command.)
>y
Do you want to save the event? (Y/N)
>y

1. 3 Confirmation of events

: list 
(No.)   (Event Name)     (Schedule)                     (Next back to the decision)
0 *      xxxxxxxxx        When IP address changes (every 7 days)       07/29 06:27ー

Manual execution
:ex 0
+ ddns_valuedomain was executed on 7/22 6:33
IP address updated.

1. 4 Automatic execution of Dice

Start the DiCE daemon

# /usr/local/bin/DiCE/diced -d -l

Make sure it’s running.

# ps aux | grep diced
root 5346 12.2 0.0 5440 492 ? Ss 06:37 0:04
/usr/local/bin/DiCE/diced -d -l

Set to start automatically.

# vi /etc/rc.local
/usr/local/bin/DiCE/diced -d -l ←add
If /etc/rc.local is not present
If you want to become systemd and run the program at startup, write a script to register it as a service.
In Debian, if you write /etc/rc.local as root and set up the execution bit, it will be executed automatically by the rc-local service.
Create a new /etc/rc.local
# vi /etc/rc.local
#!/bin/sh
/usr/sbin/ethtool -s eno1 wol g
※ eno1 is the name of your network interface(# Check with ip addr)
# chmod 700 /etc/rc.local

2. Steps to migrate to MySQL 8.0

Old Server  MySQL5.6  Database;test-db  Database User;test-db-user
New Server MySQL8.0

2.1 Backup on new server

# mysqldump -u root -p [New password]  –all-databases  –single-transaction

2.2 Working on the old server

①Take a dump of the DB you want to migrate

# mysqldump -u root -p –flush-logs test-db > test-db.sql

②If the database engine of the old server is MyISAM, you need to convert it to InnoDB with the following command

# sed -i ‘s/ENGINE=MyISAM/Engine=InnoDB/g’ test-db.sql

③Bring the retrieved dump to the new server by rsync or scp.

2.3 Working on the new server

①Create a new database that will be migrated.

# mysql -u root -p mysql
mysql>create database test_db;
MySQL 8.0 does not allow – (hyphen) in the database name, so use _ (underscore)

②Pour the database of the old server into the new server.

# mysql -u root -p test_db < test-db.sql

③Determine the database user and password, and grant permissions.

# mysql -u root -p
mysql>create user test_db_user@localhost identified by ‘<PASSWD>‘;
※<PASSWD> is arbitrary.
mysql> grant all on test_db.* to ‘test_db_user’@’localhost’;
mysql> flush privileges;
mysql> exit
タイトルとURLをコピーしました