A, mysql installation
Before building the project released under linux, migration issues when the last remnants of the database, how to migrate from windows to linux? Here is first installed mysql database
1, download the installation package mysql
Here download the following version of mysql
https://cdn.mysql.com//Downloads/MySQL-5.7/mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz
After downloading linux server to upload
2, extract
[root@localhost sdb1]# tar -xzvf mysql-5.7.26-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
Extract it to the specified path, and change the name of a command via the mv mysql
3, create users and groups
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -r -g mysql mysql
4, the installation directory owner and owning group changed mysql
[root@localhost ~]# chown -R mysql.mysql /usr/local/mysql
5. Create a data folder, data in database tables and the like for storage
[root @ localhost mysql] # mkdir # to enter the Data folder mysql
6, initialization
Installation dependencies
[root@localhost mysql]# yum install libaio
Initialized
[root@localhost mysql]# /usr/local/mysql/bin/mysqld --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize
7, edit the configuration file
/etc/my.cnf
Writes the following in the configuration file
[mysqld] datadir=/usr/local/mysql/data basedir=/usr/local/mysql socket=/tmp/mysql.sock user=mysql port=3306 character-set-server=utf8 # 取消密码验证 skip-grant-tables # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # skip-grant-tables [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
8, will be added to the mysql service
[root@localhost mysql]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
9, boot
[root@localhost mysql]# chkconfig mysql on
10, start mysql service
[root@localhost mysql]# service mysql start
11, landing mysql
Skip the password in the configuration file /etc/my.cnf the landing, so you can avoid dense landing
[root@localhost mysql]# /usr/local/mysql/bin/mysql -uroot -p
It can be added to the environment variable
Edit Profile
[root@localhost mysql]# vim /etc/profile
Export
[root@localhost mysql]# source /etc/profile
Then you can use
[root@localhost mysql]# mysql -u root -p
Into mysql
Second, the database migration
You need to move before the project windows in the database to llinux, which is to be carried out.
The sql file exported in the windows of local navicat, generate yw_crm.sql file
At this time, first check the project configuration database information
1, the new database
Because the database is yw_crm, we need to create a new database
mysql> create database yw_crm -> ; Query OK, 1 row affected (0.00 sec)
2, set the encoding
To prevent database files appear garbled, into the database, encoding settings
mysql> use yw_crm Database changed mysql> set names utf8; Query OK, 0 rows affected (0.00 sec)
3, import sql file
You will have been uploaded to the linux sql file into the database
mysql> source /root/Envs/yw_crm_project/yw_crm.sql Query OK, 0 rows affected (0.00 sec) Query OK, 0 rows affected, 1 warning (0.12 sec) Query OK, 0 rows affected (0.39 sec)
4. Check whether success
We can see that the import was successful.
Then go landing before the following items, to see if there verification code problem?
At this time has no problem.
mysql installation refer to the article: https://blog.csdn.net/weixin_42734930/article/details/81743047