Summary of problems and difficulties encountered when installing MySQL 5.6 in CentOS 7, centosmysql

Source: Internet
Author: User

Summary of problems and difficulties encountered when installing MySQL 5.6 in CentOS 7, centosmysql

When installing MySQL 5.6 (5.6.19 MySQL Community Server) on a testing Server (CentOS Linux release 7.2.1511), the following error occurs because the default database of CentOS 7 is no longer MySQL, instead, MariaDB. when MySQL is installed, the mysql lib library conflicts with the mariadb library and package, as shown in the following details (a large number of logs are omitted)

 

[root@azrlnx06 tmp]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing...                          ################################# [100%]
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        ........................................................................................................................................................................
        file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64
        file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-advanced-5.6.20-1.rhel5.x86_64 conflicts with file from package mariadb-libs-1:5.5.50-1.el7_2.x86_64

Check whether mariadb-related components exist, and then delete mariadb-related components. As follows:

 

[root@azrlnx06 mysql]# more /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core) 
[root@azrlnx06 mysql]# rpm -qa |grep mariadb
mariadb-libs-5.5.50-1.el7_2.x86_64
[root@azrlnx06 mysql]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@azrlnx06 mysql]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64 --nodeps

Of course, a dependency error occurs when you delete the mariadb-libs-5.5.50-1.el7_2.x86_64 component here, So force the component to be deleted. It is best to use yum to delete mariadb-related components. Then I encountered an "error: MySQL-server-advanced-5.6.20-1.rhel5.x86_64: install failed" error while re-installing MySQL, as shown below:

 

[root@azrlnx06 mysql]# cd /tmp
[root@azrlnx06 tmp]# ls
hsperfdata_azrlnx06  jirasetup  MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm
[root@azrlnx06 tmp]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]
error: unpacking of archive failed on file /usr/bin/innochecksum;582535c8: cpio: read failed - No such file or directory
error: MySQL-server-advanced-5.6.20-1.rhel5.x86_64: install failed
[root@azrlnx06 tmp]# 

This error is a bit confusing. After you uninstall MySQL-related components, reinstall MySQL and find that Perl-related modules are missing. As follows:

 
[root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]
FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:
Data::Dumper
[root@azrlnx06 jirasetup]# 

 

 

Install the perl-devel package using yum (Note: when MySQL is installed, the installation details are not output because the Perl-related modules are not installed,The installation of perl-Data-Dumper is also missing.)

[Root @ azrlnx06 jirasetup] # yum install-y perl-devel

After Perl-related components are installed, reinstall MySQL as shown in the following figure. The installation is successful, but no installation details are output (because perl-Data-Dumper is not installed). An error is returned when MySQL is started.

root@azrlnx06 jirasetup]# rpm -ivh MySQL-server-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-server-advanced-5.6.20-1.rh################################# [100%]
[root@azrlnx06 jirasetup]# rpm -ivh MySQL-client-advanced-5.6.20-1.rhel5.x86_64.rpm 
Preparing...                          ################################# [100%]
Updating / installing...
   1:MySQL-client-advanced-5.6.20-1.rh################################# [100%]
[root@azrlnx06 ~]# service mysql start
Starting MySQL............. ERROR! The server quit without updating PID file (/var/lib/mysql/azrlnx06.pid).
[root@azrlnx06 ~]# 

 

Find the MySQL Error Log and check the/var/lib/mysql/azrlnx06.err error log. The following error message is displayed:

 

[root@azrlnx06 mysql]# find / -name *.err
/var/lib/mysql/azrlnx06.err
/var/log/azure/Microsoft.OSTCExtensions.LinuxDiagnostic/2.3.9011/mdsd.err
/var/log/azure/Microsoft.OSTCExtensions.LinuxDiagnostic/2.3.9013/mdsd.err
/var/log/mdsd/mdsd.err
 
[root@azrlnx06 mysql]# more /var/lib/mysql/azrlnx06.err
161111 03:28:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2016-11-11 03:28:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-11-11 03:28:25 2144 [Note] Plugin 'FEDERATED' is disabled.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
2016-11-11 03:28:25 2144 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2016-11-11 03:28:25 2144 [Note] InnoDB: Using atomics to ref count buffer pool pages
2016-11-11 03:28:25 2144 [Note] InnoDB: The InnoDB memory heap is disabled
2016-11-11 03:28:25 2144 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-11-11 03:28:25 2144 [Note] InnoDB: Memory barrier is not used
2016-11-11 03:28:25 2144 [Note] InnoDB: Compressed tables use zlib 1.2.3
2016-11-11 03:28:25 2144 [Note] InnoDB: Using Linux native AIO
2016-11-11 03:28:25 2144 [Note] InnoDB: Using CPU crc32 instructions
2016-11-11 03:28:25 2144 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2016-11-11 03:28:25 2144 [Note] InnoDB: Completed initialization of buffer pool
2016-11-11 03:28:25 2144 [Note] InnoDB: The first specified data file ./ibdata1 did not exist: a new database to be created!
2016-11-11 03:28:25 2144 [Note] InnoDB: Setting file ./ibdata1 size to 12 MB
2016-11-11 03:28:25 2144 [Note] InnoDB: Database physically writes the file full: wait...
2016-11-11 03:28:26 2144 [Note] InnoDB: Setting log file ./ib_logfile101 size to 48 MB
2016-11-11 03:28:31 2144 [Note] InnoDB: Setting log file ./ib_logfile1 size to 48 MB
2016-11-11 03:28:37 2144 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2016-11-11 03:28:37 2144 [Warning] InnoDB: New log files created, LSN=45781
2016-11-11 03:28:37 2144 [Note] InnoDB: Doublewrite buffer not found: creating new
2016-11-11 03:28:37 2144 [Note] InnoDB: Doublewrite buffer created
2016-11-11 03:28:37 2144 [Note] InnoDB: 128 rollback segment(s) are active.
2016-11-11 03:28:37 2144 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-11-11 03:28:37 2144 [Note] InnoDB: Foreign key constraint system tables created
2016-11-11 03:28:37 2144 [Note] InnoDB: Creating tablespace and datafile system tables.
2016-11-11 03:28:38 2144 [Note] InnoDB: Tablespace and datafile system tables created.
2016-11-11 03:28:38 2144 [Note] InnoDB: Waiting for purge to start
2016-11-11 03:28:38 2144 [Note] InnoDB: 5.6.20 started; log sequence number 0
2016-11-11 03:28:38 2144 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: ef3b0cd5-a7be-11e6-98b3-000d3a8062fe.
2016-11-11 03:28:38 2144 [Note] RSA private key file not found: /var/lib/mysql//private_key.pem. Some authentication plugins will not work.
2016-11-11 03:28:38 2144 [Note] RSA public key file not found: /var/lib/mysql//public_key.pem. Some authentication plugins will not work.
2016-11-11 03:28:38 2144 [Note] Server hostname (bind-address): '*'; port: 3306
2016-11-11 03:28:38 2144 [Note] IPv6 is available.
2016-11-11 03:28:38 2144 [Note]   - '::' resolves to '::';
2016-11-11 03:28:38 2144 [Note] Server socket created on IP: '::'.
2016-11-11 03:28:38 2144 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
161111 03:28:38 mysqld_safe mysqld from pid file /var/lib/mysql/azrlnx06.pid ended

After searching for relevant information, the perl-Data-Dumper module is not installed. As a result, the initialization of the database fails during the installation process. Therefore, the related system table cannot be found when the MySQL service is started. For details, refer to the official MySQL-server RPM does not install perl-Data-Dumper as a dependency document.

Description:

MySQL-server requires perl-Data-Dumper to function. however, perl-Data-Dumper is not listed by the MySQL-server RPM as a dependency. so if a linux server does not have perl-Data-Dumper installed, the install-mysql-db will fail. and because of missing the initial database, the mysql service cocould not be started.

How to repeat:

On a linux server, make sure there is no perl-Data-Dumper installed. Install MySQL-server using yum. There shocould be error message complaining database cocould not be created.

Suggested fix:

Add perl-Data-Dumper as a dependency of the RPM package

Solution:

1: Install the perl-Data-Dumper module.

[Root @ azrlnx06 mysql] # yum install-y perl-Data-Dumper

2. initialize the database.

[Root @ azrlnx06 mysql] # sudo mysql_install_db -- user = mysql -- basedir =/usr/-- ldata =/var/lib/mysql/

[root@azrlnx06 mysql]# service mysql start
 
Starting MySQL. SUCCESS! 
 
[root@azrlnx06 mysql]# /usr//bin/mysqladmin -u root password 'Qwe!23'
 
Warning: Using a password on the command line interface can be insecure.

 

 

Of course, you can also uninstall MySQL and reinstall it to see the Detail output during the installation 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.