How to install and configure mysql 5.7 On a Linux Virtual Machine: graphic tutorial, mysql5.7
Record how to install and configure MySQL in a Linux Virtual Machine
1. Download mysql5.7
Http://mirrors.sohu.com/mysql/MySQL-5.7/
Linux download:
Enter the command: wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
2. Create a user and mysql directory
1. Create a mysql Group
Enter the command: groupadd mysql
2. Create a mysql user and put it in the mysql group.
Enter the command: useradd-r-g mysql
3. Set a password for the mysql user
Run passwd mysql.
Iii. Decompress mysql
1. Move the downloaded mysql package to a Linux Virtual Machine
2. Copy the tar package to the/usr/local directory.
Enter the command: mv/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz/usr/local
3. Decompress
Enter the command: cd/usr/local
Input command: tar xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz
4. Change the name of the extracted file to mysql.
Input command: mv mysql-5.7.17-linux-glibc2.5-x86_64 mysql
4. Configure the startup configuration file
1. Copy my_default.cnf to/etc/my. cnf (read automatically when mysql is started)
Enter the command: cp my-default.cnf/etc/my. cnf
2. Solve the garbled Problem
Run vi/etc/my. cnf.
Change:
[mysql]default-character-set=utf8[mysqld]default-storage-engine=INNODBcharacter_set_server=utf8
3. Copy mysql. server to/etc/init. d/
Run cp mysql. server/etc/init. d/mysql
4. Modify the/etc/init. d/mysql parameter and give two directory locations.
Run vi/etc/init. d/mysql.
Change: basedir =/usr/local/mysql
Datadir =/usr/local/mysql/data
5. Change owner of directory/usr/local/mysql
Run chown-R mysql: mysql/usr/local/mysql/
V. initialize the mysql database
1. initialize the database
First, go to the mysql/bin directory.
Command for earlier versions: mysql_install_db
Command for the new version:./mysqld -- initialize -- user = mysql -- basedir =/usr/local/mysql -- datadir =/usr/local/mysql/data
Generate a data Directory, which indicates that the database has been initialized successfully.
2. Database Encryption
Enter the command:./mysql_ssl_rsa-setup-datadir =/usr/local/mysql/data
3. Start mysql
Enter the command:./mysqld_safe -- user = mysql &
& Symbol: throwing the current process to the background
6. Enter the client
1. log on
Enter the command:./mysql-uroot-p
Enter your temporary password.
2. Change the password
Enter the command: set password = password ('your password ');
VII. Windows Remote Access to mysql of Linux Virtual Machine
1. First, you must disable the firewall so that the window can be connected.
Run systemctl stop firewalld. service.
2. Authorize window
Enter the command: grant all privileges on *. * to root @ '%' identifiedby '123 ';
3. remote connection to Windows
Enter the command: mysql-hIP address-uroot-p123456
8. Set automatic start of mysql service upon startup
1. Add the mysql Service
Enter the command: chkconfig -- add mysql
2. Set Service Startup
Enter the command: chkconfig mysql on
9. Set the path environment variable
Run vi/etc/profile.
Set the environment variable: export PATH = $ JAVA_HOME/bin:/usr/local/mysql/bin: $ PATH
10. Complete
In this way, our mysql database is configured.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.