centos6.9 installation mysql5.7

Source: Internet
Author: User

    • Summary: CentOS6.9 install Mysql5.7 One, upload installation package II, build users and MySQL directory 1, set up a MySQL group input command: GROUPADDMYSQL2, build MySQL user, and put into the MySQL group Input command: USERADD-R-GMYSQLMYSQL3, set Password input command for MySQL User: Passwdmysql, unzip the MYSQL1, copy the tar package to the/usr/local/mysql directory 2, Decompression Tar-zxvfmysql.tar3, the extracted files to change the name, changed to MySQL four, configuration related to the start
    • CentOS6.9 Installation Mysql5.7First, upload the installation package

      Ii. Creating a directory for users and MySQL1. 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 MySQL1. Copy the tar package to the/usr/local/mysql directory

      2. Decompression

      TAR-ZXVF Mysql.tar

      3. Change the extracted file name to MySQL

      Iv. Configuring the relevant startup files1. Copy my_default.cnf to/ETC/MY.CNF (automatically read when MySQL starts)

      Backup my.cnf

      Copy 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/

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

      Input command: Vim/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. Initializing the database

      Old command./mysql_install_db--user=mysql--basedir=/usr/local/mysql/--datadir=/usr/local/mysql/data/

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

      Vi. starting the database

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

      &; symbols: Throw the current process to the background

      Seven, change the password

      View initialization auto-generated password: Cat/root/.mysql_secret

      Go to mysql:bin/mysql-uroot-p (paste the password you just copied up)

      Reset root Password after login
      mysql> SET PASSWORD for ' root ' @localhost = PASSWORD (' 123456 ');

      viii. Native connection to the virtual machine database

      Check to see if only the root localhost permission is granted, if remote Access cannot connect

      Mysql> Select Host, User, Password from Mysql.user;

      Grant% permissions to root

      mysql> Update user Set host = '% ' where host = ' localhost ';

      mysql> flush Privileges;

      Complete!

      ix. Problems1./mysqld_safe:line 586:/var/lib/mysql/mysqld_safe.pid: No file or directory

      Workaround:

      (1) Because of the troubleshooting, no error log, so temporarily take the way to supplement the directory

      Mkdir-p/var/lib/mysql

      Chown Mysql:mysql/var/lib/mysql

      (2) After the Supplemental catalogue appears can ' t open and Lock Privilege tables:table ' mysql.user ' doesn ' t exist

      DataDir path Error change path in My.ini

      2, Mysqld_safe mysqld from PID File/usr/local/mysql/localhost.pid ended

      Query log: Discovery: The error means mysqld does not has the access rights to the directory.

      Change permissions: Chmod-r 777

      A new problem arises: Can ' t open the Mysql.plugin table. Please run Mysql_upgrade to create it.

      WORKAROUND: Re-initialize with the old command

      3, starting MySQL ..... error! The server quit without updating PID file (/usr/local/mysql/centos6.9.wzy.com.pid).

      The problem: My.ini Character_set_server=utf8 Write wrong

      My.ini was changed to the wrong time before changing the problem datadir=/usr/local/mysql/data

centos6.9 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.