Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install MySQL 5.7 unzipped version of CentOS7

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article is about how CentOS7 installs MySQL 5.7 unzipped version. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1. Download the installation package

Http://dev.mysql.com/downloads/mysql/#downloads

two。 Check whether the library file exists, if deleted.

[root@localhost Desktop] $rpm-qa | grep mysqlmysql-libs-5.1.52-1.el6_0.1.x86_64 [root@localhost ~] $rpm-e mysql-libs-5.1.52.x86_64-- nodeps [root@localhost ~] $

3. Check whether mysql groups and users exist, if not created.

[root@localhost ~] $cat / etc/group | grep mysqlmysql:x:490: [root@localhost ~] $cat / etc/passwd | the default is above grep mysqlmysql:x:496:490::/home/mysql:/bin/bash. If none, execute the add command: [root@localhost ~] $groupadd mysql [root@localhost ~] $useradd-r-g mysqlmysql / / useradd-r indicates that mysql user is a system user and cannot be used to log in to the system.

4. Extract the TAR package and change the group and user to which it belongs

[root@localhost] $cd / usr/local/ [root@localhost local] $tar xvf mysql-5.7.12-linux-glibc2.5-x86_ 64.tar [root @ localhost local] $ls-ltotal 1306432Murray rwxrmuri. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_ 64.tar.gz [root @ localhost local] $tar xvfz mysql-5.7.12-linux-glibc2.5-x86_ 64.tar.gz [localhost local] $mv mysql-5.7.12-linux-glibc2.5-x86_64 mysql [root@localhost local] $ls-ltotal 1306436drwxr-xr-x. 2 root root 4096 Dec 4 2009 bindrwxr-xr-x. 2 root root 4096 Dec 4 2009 etcdrwxr-xr-x. 2 root root 4096 Dec 4 2009 gamesdrwxr-xr-x. 2 root root 4096 Dec 4 2009 includedrwxr-xr-x. 2 root root 4096 Dec 4 2009 libdrwxr-xr-x. 3 root root 4096 Dec 2 14:36 lib64drwxr-xr-x. 2 root root 4096 Dec 4 2009 libexecdrwxr-xr-x. 9 7161 wheel 4096 Mar 28 12:51 mysql-rwxr--r--. 1 root root 668866560 Jun 1 15:07 mysql-5.7.12-linux-glibc2.5-x86_64.tar-rw-r--r--. 1 7161 wheel 638960236 Mar 28 12:54 mysql-5.7.12-linux-glibc2.5-x86_64.tar.gz-rw-r--r--. 1 7161 wheel 29903372 Mar 28 12:48 mysql-test-5.7.12-linux-glibc2.5-x86_64.tar.gzdrwxr-xr-x. 2 root root 4096 Dec 4 2009 sbindrwxr-xr-x. 6 root root 4096 Dec 2 14:36 sharedrwxr-xr-x. 2 root root 4096 Dec 4 2009 src [root@localhost local] $chown-R mysql mysql/ [root@localhost local] $chgrp-R mysql mysql/ [root@localhost local] $cd mysql/

5. Install and initialize the database

[root@localhost mysql] $bin/mysql_install_db-user=mysql-basedir=/usr/local/mysql/-datadir=/usr/local/mysql/data/2016-06-01 15:23:25 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-- initialize2016-06-01 15:23:30 [WARNING] The bootstrap log isn't empty:2016-06-01 15:23:30 [WARNING] 2016-06-01T22:23:25.491840Z 0 [Warning]-- bootstrap is deprecated. Please consider using-- initialize instead2016-06-01T22:23:25.492256Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000) 2016-06-01T22:23:25.492260Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

If you change the default installation path, you need 1) / etc/my.cnf, / etc/init.d/mysqld modify basedir='/apps/mysql' datadir='/apps/mysql/data' 2) create ln mkdir-p / usr/local/mysql/bin ln-s / apps/mysql/bin/mysqld / usr/local/mysql/bin/mysqld

[root@localhost mysql] $[root@localhost mysql] $cp-a. / support-files/my-default.cnf / etc/my.cnf [root@localhost mysql] $cp-a. / support-files/mysql.server / etc/init.d/mysqld [root@localhost mysql] $cd bin/ [root@localhost bin] #. / mysqld_safe-- user=mysql & [1] 2932 [root@localhost bin] # 2016-06-01T22:27:09.708557Z mysqld_safe Logging to'/ usr/local / mysql/data/localhost.localdomain.err'.2016-06-01T22:27:09.854913Z mysqld_safe Starting mysqld daemon with databases from / usr/local/mysql/data [root@localhost bin] # / etc/init.d/mysqld restartShutting down MySQL..2016-06-01T22:27:50.498694Z mysqld_safe mysqld from pid file / usr/local/mysql/data/localhost.localdomain.pid ended success starting MySQL. SUCCESS! [1] + Done. / mysqld_safe-- user=mysql [root@localhost bin] $/ / set boot [root@localhost bin] $chkconfig-- level 35 mysqld on [root@localhost bin] $

6. Initialize password

Mysql5.7 will generate an initialization password, and login is not required for the first login in the previous version.

[root@localhost bin] $cat / root/.mysql_secret# Password set for user 'root@localhost' at 2016-06-01 15 Fraser 23 purl 25 xxxxR5H9 [root@localhost bin] $. / mysql-uroot-pEnter password:Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.7.12Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > SET PASSWORD = PASSWORD ('123456'); Query OK, 0 rows affected, 1 warning (0.00 sec) mysql > flush privileges;Query OK, 0 rows affected (0.00 sec)

7. Add remote access permission

Mysql > use mysql;Reading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with-ADatabase changedmysql > update user set host ='% 'where user =' root';Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0mysql > select host, user from user +-+-+ | host | user | +-+-+ |% | root | | localhost | mysql.sys | +-+-+ / / it will not take effect until it is restarted. / etc/init.d/mysqld restart

Problems encountered:

Unable to find a solution to the mysql.sock,mysql.sock loss problem

When connecting to Mysql, the mysql.sock file cannot be found on the machine. You can simply recreate it by restarting the server. Because the server recreates it when it starts.

[root@localhost mysql-5.7.13] # / bin/mysql_install_db-- user=mysql2016-06-26 02:47:09 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-initialize2016-06-26 02:47:09 [ERROR] The data directory needs to be specified.

Solution: you need to create a new data directory and specify the installation directory (if it is not the default directory, the default path is / usr/local/mysql, and the basedir and datadir in. / support-files/mysql.server are the corresponding paths).

[root@localhost mysql-5.7.13] # / bin/mysql_install_db-user=mysql-basedir=/usr/local/mysql-5.7.13/-datadir=/usr/local/mysql-5.7.13/data/2016-06-26 02:48:47 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld-- initialize2016-06-26 02:49:19 [WARNING] The bootstrap log isn't empty:2016-06-26 02:49:19 [WARNING] 2016-06-26T09:48:50.798592Z 0 [Warning]-- bootstrap is deprecated. Please consider using-- initialize instead2016-06-26T09:48:50.898732Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000) 2016-06-26T09:48:50.898778Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

The above errors are all due to the failure to specify a custom path in the mysql.server.

If it is also prompted that there is already a data file, delete it and create a new one.

Thank you for reading! This is the end of the article on "how to install MySQL 5.7 decompressed version of CentOS7". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report