How does EasyNTS, a video cloud networking platform, replace the Sqllite database with a mysql database?

The video platform or cloud networking platform developed by the Qingxi team can migrate the database. Some time ago we introduced how EasyDSS migrates the database to the Mysql database . Then we will also talk about the migration method of the video cloud networking EasyNTS.

Recently, a customer used our EasyNTS system and wanted to use mysql database for storage. At present, EasyNTS uses the Sqllite database by default, which cannot be deployed in a distributed manner. Below we introduce the replacement of EasyNTS Sqllite database with mysql database.

First, install Centos and install Mysql online

1.1 yum -y install mysql-community-server, you need to wait a little while downloading more things

1146.png

1.2 start mysql

systemctl start mysqld

1.3 Set boot up

systemctl enable mysqld
systemctl daemon-reload

1.4 View the database password through the cat /var/log/mysqld.log | grep password command

1147.png

1.5 Enter the database login interface through mysql -uroot -p, enter the password you just found to log in to the database, just copy and paste, the MySQL login password is also not displayed

1148.png

1.6 Through the ALTER USER'root'@'localhost' IDENTIFIED WITH mysql_native_password BY'your password'; command to modify the password

Exit MySQL through the exit; command, and then log in again through the new password (root)

1149.png

1.7. Authorize the remote access of EasyNTS host through the following command

create user 'root'@'%' identified with mysql_native_password by '你的密码';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;

1150.png

1.8. Enter exit to exit, open the firewall to open port 3306

If the firewall is not turned on, enter: systemctl start firewalld to open

1151.png

Enter the following command to open port 3306
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload

1157.png

1.9. Configure the default encoding as UTF-8

Modify the /etc/my.cnf configuration file and add the encoding configuration under [mysqld], as shown below:

character_set_server=utf8
init_connect='SET NAMES utf8'

1152.png

1.10. After editing and saving, restart mysql service: systemctl restart mysqld

1153.png

2. After the installation is complete, modify the EasyNTS configuration file

2.1 Comment out sqllite3 in [database]

[database]
; Configure sqlite3 database name to support sqlite3 and mysql, sqlite3 is enabled by default
; database_dialect = sqlite3
; database_url = easynts.db

2.2 Remove the MYSQL configuration comment and change it to the corresponding

; MYSQL configuration is as follows, if you open it, you need to close the configuration of sqlite3

database_dialect = mysql
 database_url = root:root@tcp(192.168.10.2:3306)/easynts?charset=utf8&parseTime=True&loc=Local

among them

1154.png

2.3 Log in to the database system and establish the corresponding database. Pay attention to ensure that the database name in the configuration file is consistent with this.

Mysql > create database easynts;
Query OK, 1 row affected (0.05 sec )

2.4 Restart the server, the system will automatically create related tables.

1155.png

2.5 Visit the page, the page can be opened normally.

1156.png

Guess you like

Origin blog.csdn.net/EasyNTS/article/details/107833586