Linux virtual machine under installation configuration MySQL

Source: Internet
Author: User
Tags windows remote access

First, download mysql5.7

http://mirrors.sohu.com/mysql/MySQL-5.7/

Linux Downloads:

Input command:wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

Second, the establishment of users, as well as the MySQL directory

1. Set up a MySQL group

Input command: groupadd MySQL

2. Build MySQL user and put it into MySQL group

Input command:useradd-r-g MySQL MySQL

3. Set password for MySQL user

Input command:passwd MySQL

Third, decompression MySQL

1. Move the downloaded MySQL package to the Linux virtual machine

2. Copy the tar package to the/usr/local directory

Input command:mv/software/mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz/usr/local

3. Decompression

Input command:cd/usr/local

Input command:tar xzvf mysql-5.7.17-linux-glibc2.5-x86_64.tar.gz

4. Change the extracted file name to MySQL

Input command:mv mysql-5.7.17-linux-glibc2.5-x86_64 MySQL

Iv. configuration-related boot configuration files

1. Copy my_default.cnf to/ETC/MY.CNF (automatically read when MySQL starts)

Input command:CP my-default.cnf/etc/my.cnf

2, solve garbled problem

Input command:vi/etc/my.cnf

Change:

[MySQL]

Default-character-set=utf8

[Mysqld]

Default-storage-engine=innodb

Character_set_server=utf8

3, copy Mysql.server to/etc/init.d/

Input command:CP mysql.server/etc/init.d/mysql

4, modify the/etc/init.d/mysql parameter, give 2 directory location

Input command:vi/etc/init.d/mysql

Change:basedir=/usr/local/mysql

Datadir=/usr/local/mysql/data

5, to the directory/usr/local/mysql change owner

Input command:chown-r mysql:mysql/usr/local/mysql/

V. Initialize the MySQL database

1. Initialize the database

The first thing to do is to go to the Mysql/bin directory

Old version of the command:mysql_install_db

New version of the command:./mysqld--initialize--user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data

Generate a data directory that represents the successful initialization of the database

2. Encrypt the database

Input command:./mysql_ssl_rsa-setup-datadir=/usr/local/mysql/data

3. Start MySQL

Input command:./mysqld_safe--user=mysql &

& symbols: Throw the current process to the background

Vi. entering the client

1. Login

Input command:./mysql-uroot–p

and enter your temporary password.

2. Change the password

Input command:set Password=password (' Your password ');

Vii. Windows remote access to Linux virtual machine MySQL

1, first to shut down the firewall, so that window can connect to the

Input command:systemctl stop Firewalld.service

2. Authorization to Window

Input command: grant all privileges on * * to [email protected] '% ' identified by ' 123456 ';

3. Window Remote Connection

Input command:mysql–hip address-uroot-p123456

Eight, set the boot automatically start the MySQL service

1. Add service MySQL

Input command:chkconfig--add MySQL

2. Set up service start-up

Input command:chkconfig MySQL on

Ix. Setting the PATH environment variable

Input command:vi/etc/profile

Set environment variables:export path= $JAVA _home/bin:/usr/local/mysql/bin: $PATH

Ten, complete

So our MySQL database is configured.

Linux virtual machine under installation configuration MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.