Centos6.5 installing MySQL 5.7

Source: Internet
Author: User

1. Download the installation package on the official website: https://dev.mysql.com/downloads/mysql/5.7.html#downloads

Mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

2. Upload the installation package to CentOS. The directory I installed is in/usr/local/

1[[Email protected] bin]# CD/2[[Email protected]/]# cd usr3[Email protected] usr]# CD local/4 [[email protected] local]# ls5 bin etc games include Lib Lib64 libexec sbin share src6 [email protected] local]# RZ 7 8 [[email protected] local]# ls9Bin etc Games include Lib Lib64 libexecmysql-5.7.10-linux-glibc2.5- x86_64.tar.gz sbin share srcTen[Email protected] local]# TAR-XZVF mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

3, the compression package decompression: TAR-XZVF mysql-5.7.10 ...

TAR-XZVF mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz

4. Rename the extracted files: MV mysql-5.7.10 ... MySQL

1 [[email protected] local]# ls2Bin Games Lib Libexec mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz Share3etc include lib64mysql-5.7.10-linux-glibc2.5- x86_64 sbin src4[Email protected] local]#MV mysql-5.7.10-linux-glibc2.5-x86_64 MySQL5 [[email protected] local]# ls6Bin etc Games include Lib Lib64 libexecMySQLmysql-5.7.10-linux-glibc2.5-x86_64.tar.gz sbin share src

5. Start the MySQL installation file

1 ./bin/mysql_install_db  --user=mysql--basedir=/usr/local/mysql--datadir=/usr/local/mysql/data2  --initialize3 2017-09-28 11:21:59 [WARNING] The bootstrap log isn ' t empty:4 2017-09-28 11:21:59 [WARNING] 2017-09-28t03:21:55.455859z 0 [WARNING]--bootstrap is deprecated. Please consider using--initialize instead

Note The warning section: mysql_install_db has been superseded:

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

6. Set the MY.CNF configuration of MySQL (copy the files under MySQL to the/etc/directory)

Cp/usr/local/mysql/support-files/my-default.cnf/etc/my.cnf

7, modify the contents of my.cnf inside:

1 [Mysqld]2basedir=/usr/local/MySQL3datadir=/usr/local/mysql/Data4port=33065 Socket=/usr/local/mysql/mysqld.sock6 7[Client]8 default-character-set=UTF89 Socket=/usr/local/mysql/mysqld.sockTen  One [MySQL] A default-character-set=UTF8 - Socket=/usr/local/mysql/mysqld.sock

At first, the MySQL socket was not set, and the report

1 ERROR 2002 (HY000): Can ' t connect to local MySQL server through socket '/tmp/mysql.sock ' (2)

Set up a socket to solve, in fact, create a soft connection is also a good choice: Ln-s/usr/local/mysql/mysqld.sock/tmp/mysql.sock

8. Start MySQL:

Service mysqld Restart

9. Prompt to change Password:

1 [[email protected] etc]# MySQL 2 Access denied for user ' root ' @ ' localhost ' (using Password:no) 3 [[email protected] etc]# mysql-uroot-p4

10. Check the default password for MySQL:

1 cat/root/ . Mysql_secret 2  for 3 uq?x&q+gu#o*

11. Change the default password after logging in with the default password:

1 Set Password = password ("root") 2     ; 3 Query OK, 0 rows affected, 1 Warning (0.00 sec)45 mysql> flush privileges;
    6 Query OK, 0 rows affected (0.00 sec)78 mysql> use MySQL

Then you can do the corresponding operation of the database.

Centos6.5 installing MySQL 5.7

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.