Linux Online Perfect installation mysql2.7.22

Source: Internet
Author: User

1, download the tar package, can directly download the server online

wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

2. Install MySQL under/usr/local/mysql

# Unzip

TAR-XVF mysql-5.7.22-linux-glibc2.12-x86_64.tar.gz

# Mobile

MV mysql-5.7.22-linux-glibc2.12-x86_64/usr/local/

# rename

Mv/usr/local/mysql-5.7.22-linux-glibc2.12-x86_64/usr/local/mysql

3. New Data Directory

Mkdir/usr/local/mysql/data

4. New MySQL user, MySQL user group

# MySQL User group

Groupadd MySQL

# MySQL User

Useradd mysql-g MySQL

5. Change the owner of the/usr/local/mysql and the owning group to MySQL

Chown-r Mysql.mysql/usr/local/mysql

6. Configuration

/usr/local/mysql/bin/mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data

# Edit/ETC/MY.CNF

[mysqld]datadir=/usr/local/mysql/databasedir=/usr/local/mysqlsocket=/tmp/mysql.sockuser=mysqlport= 3306character-set-server=utf8
# Cancel Password Verification
skip-grant-tables# disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0# Skip-grant-tables[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid

7. Open Service

# Add MySQL to the service

Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql

# power-On self-booting

Chkconfig MySQL on

# Open

Service MySQL Start

8. Set the password

# login (because the/ETC/MY.CNF is set to cancel password authentication, so here password any)

/usr/local/mysql/bin/mysql-u root-p

# operation MySQL Database

>>use MySQL;

# Change Password

>>update user Set Authentication_string=password (' Your password ') where user= ' root ';

>>flush privileges;

>>exit;

9. Delete the skip-grant-tables in/etc/my.cnf

10, login to set the password again (do not know why if you do not set the password again can not operate the database)

/usr/local/mysql/bin/mysql-u root-p

>>alter USER ' root ' @ ' localhost ' identified by ' modified password ';

>>exit;

11. Allow Remote Connection

/usr/local/mysql/bin/mysql-u root-p

>>use MySQL;

>>update user set host= '% ' where user = ' root ';

>>flush privileges;

>>exit;

12. Add Shortcut

Ln-s/usr/local/mysql/bin/mysql/usr/bin

Linux Online Perfect installation mysql2.7.22

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.