Linux installation mysql5.7

Source: Internet
Author: User

Building the server first step: Install the database

I chose the more general MySQL here to meet most of the market needs.

First of all, prepare the MySQL compression pack Xshell and xftp here to address: Https://pan.baidu.com/s/1DHZaroNWV78TYnob5kOTgg

1, download the tar package on the link above, or use wget to download it from official website

  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

# If the following error occurs:

2018- -- -  .: +: +[WARNING] mysql_install_db isDeprecated. Consider switching to mysqld--Initialize2018- -- -  .: +: +[ERROR] Child process:/usr/local/mysql/bin/mysqldterminated prematurely with errno= +2018- -- -  .: +: +[ERROR] Failed to Execute/usr/local/mysql/bin/mysqld--bootstrap--datadir=/usr/local/mysql/data--lc-messages-dir=/usr/ Local/mysql/share--lc-messages=en_us--basedir=/usr/local/MySQL--server log begin----Server Log End--

# Use the following command:

/usr/local/mysql/bin/mysqld--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data--initialize

# If the following error occurs:

/usr/local/mysql/bin/mysqld:error while loading shared libraries:libnuma.so. 1 Object or directory

# then execute the following command:

Yum-y Install Numactl

# continue installation after completion:

/usr/local/mysql/bin/mysqld--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data--initialize

# Edit/ETC/MY.CNF

[Mysqld]datadir=/usr/local/mysql/databasedir=/usr/local/mysqlsocket=/tmp/  Mysql.sockuser=mysqlport=3306character-set-server=utf8# Cancel Password Authentication Skip- grant-tables# Disabling symbolic are 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;

>>eixt;

  12. Add Shortcut

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

SOURCE Quote: https://www.cnblogs.com/daemon-/p/9009360.html

Linux installation mysql5.7

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.