Cenos Install the latest version of MySQL (5.7.18) record. Uninstall the old version of the process

Source: Internet
Author: User
Tags new set

First of all: the old version of the database has no data, so there is no data backup process. If you are in the process of upgrading the database, you need to back up the data, please handle it separately.

1, download the latest version of MySQL, unzip for use

wget https:// dev.mysql.com/get/downloads/mysql-5.7/mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz #下载
TAR-ZXVF mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz #解压
Cp-r Mysql-5.7.18-linux-glibc2.5-x86_64/usr/local/mysql #复制到安装目录

2. Add Users

-G MySQL MySQL

3. Create data file directory (not in MySQL default directory)

mkdir//datas/-Rmysql.mysql/datas/777 /datas/mysql

4, uninstall the old version (here may encounter various problems)

Rpm-qa|grep-i MySQL #查找已有的包, when I had 2 (php-mysql-5.4.16-42.el7.x86_64, perl-dbd-mysql-4.023-5.el7.x86_64)
Rpm-ev php-mysql-5.4.16-42.el7.x86_64 #删除其中一个, Normal, and then another one cannot be deleted, there is a dependency on the installation package
Yum-y Remove Perl-dbd-mysql #这样才终于卸载掉

Specific This step, refer here, thank the original

Http://www.cnblogs.com/kerrycode/p/4364465.html

http://blog.csdn.net/tjcyjd/article/details/52189182

Http://www.jb51.net/os/RedHat/80289.html

5, install the new MySQL, the current user in the/var/local/mysql/directory:

./bin/mysqld--initialize--user=mysql--datadir=/datas/mysql #安装
./support-files/mysql.server Start #启动服务

There may not be a startup, the problem: Mysqld_safe error cannot create a fault log file
cd/var/log/mariadb/
VI Mariadb.log #新建一个文件
Chown Mysql.mysql Mariadb.log
chmod 777 Mariadb.log

Reference, thank the original http://tieba.baidu.com/p/5103002724

PS aux | grep MySQL #查看一下进程
/usr/local/mysql/bin/mysql-v #查看版本, is not the right

6, the installation is normal, is the initial configuration. Include: Modify root password, modify port, allow users to log in remotely

However, the installation process, it is important to note that there is an initial password "(yngqrv7m). E" (each time everyone is different, first remember, a while landing):

- -29t02:1:----[email protected]: ( yngqrv7m). E

Port:

VI/ETC/MY.CNF #编辑配置文件

Modify the following:

[Mysqld]
Datadir=/datas/mysql
port=33316

[Client]
port=33316

To modify the root user:

Log in to MySQL:

/usr/local/mysql/bin/mysql-uroot-p

If error Can ' t connect to local MySQL server through socket

This should be the "/etc/my.cnf" configuration file issue. The workaround is to modify the "/etc/my.cnf" profile, add the "[Client]" option and the "[MySQL]" option in the configuration file and use the "socket" parameter value under both options, and the "socket" parameter value under the "[Mysqld]" option, The path to the socket file is exactly the same. as follows, continue to modify MY.CNF. Reference, thank http://www.aiezu.com/db/mysql_cant_connect_through_socket.html

[Mysqld]datadir=/datas/mysqlsocket=/var/lib/mysql/mysql.sockport=33316  [client]default-character-Set=utf8socket=/var/lib/mysql/ mysql.sockport=33316[mysqld_safe]log-error=/var/log/mariadb/  Mariadb.logpid-file=/var/run/mariadb/mariadb.pid

Then log in and change root.
/usr/local/mysql/bin/mysql-uroot-p #然后输入上面记下的密码 (yngqrv7m). E
The operation may cause an error:

Mac MySQL error must reset your password using ALTER USER statement before executing this statement.
After the installation of MySQL, after landing, regardless of running any command, always prompt this. So:

SET PASSWORD = PASSWORD (' Your new PASSWORD ');
ALTER USER ' root ' @ ' localhost ' PASSWORD EXPIRE never;
Flush privileges;

Complete the above three steps to exit and re-login, using the new set of password on the line. Reference, thank http://www.cnblogs.com/debmzhang/p/5013540.html

Then, set allow remote logins:

You need to manually increase the number of users who can access the database remotely.

Method one, log in to MySQL locally, change the "host" entry in the "User" table in the "MySQL" Database, and replace "localhost" with "%"

MySQL>use mysql;mysqlset'%'where' Root ' ; MySQL>select from user;

Method two, direct authorization (recommended)

To use the root user from any host, password: youpassword (your root password) to connect to the MySQL server:

' Root '@'%'youpassword'

I do not use the method one, continue to method two is good. Not testing is not a method to perform the need to restart MySQL, as the truth should not be used.

Reference, thank http://www.cnblogs.com/hyzhou/archive/2011/12/06/2278236.html

Cenos Install the latest version of MySQL (5.7.18) record. Uninstall the old version of the process

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.