Install mysql5.7 In the offline rpm package of Centos

Source: Internet
Author: User

Install mysql5.7 In the offline rpm package of Centos

1. Before installing the new mysql version, uninstall the mariadb-lib that comes with the system.

[root@wst-test02 bbders]# rpm -qa|grep mariadbmariadb-libs-5.5.44-2.el7.centos.x86_64[root@wst-test02 bbders]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64

2. Upload and decompress the package.

Decompress the package and obtain the following installation package:

3. Run the rpm-ivh command to install python in sequence. The following steps require the root permission. The rpm commands must be executed in order due to the dependency between packages.

Rpm-ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm rpm-ivh mysql-community-libs-5.7.20-1.el7.x86_64.rpm rpm-ivh mysql-community-client-5.7.20-1.el7.x86_64.rpmrpm-ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm #### install mysql-community-server-5.7.20-1.el7.x86_64.rpm before libaio-0.3.107-10.el6.x86_64.rpm: http://mirror.centos.org/centos/6/ OS /x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm rpm -After the ivh libaio-0.3.107-10.el6.x86_64.rpm is installed successfully (if yum install libaio can be executed in a web environment), you can also delete the installation and temporary files. Rm mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar

4. initialize the database.

// Specify datadir, which will be generated after execution ~ /. Mysql_secret Password File [root @ wst-test02 bbders] # mysql_install_db -- datadir =/var/lib/m // initialization, the execution will be in/var/log/mysqld. log to generate a random password [root @ wst-test02 bbders] # mysqld -- initialize

5. Create users and user groups

[Root @ wst-test02 bbders] # groupadd mysql [root @ wst-test02 bbders] # useradd-g mysql-r mysql [root @ wst-test02 bbders] # chown mysql: mysql/var/lib/mysql-R // assign the mysql installation directory to mysql [root @ wst-test02 bbders] # systemctl start mysqld. service // restart mysql

6. Change the password

Because you do not know the password at the beginning, first modify the configuration file/etc/my. cnf so that MySQL can skip the permission verification during logon. Add one line: skip-grant-tables restart MySQL: systemctl restart mysqld password-free login MySQL: mysql-uroot-p # two consecutive times 'enter key' to change the root user password: UPDATE user SET authentication_string = password ('your-password') WHERE host = 'localhost' AND user = 'root'; modify the configuration file/etc/my. cnf deletes the newly added skip-grant-tables and restarts MySQL. This step is very important. Failure to execute this step may cause serious security problems.

Supplemental error handling:

Solution:chown mysql:mysql -R /var/lib/mysql

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.