A problem with MySQL 5.5 deployment

A problem with MySQL 5.5 deployment

MySQL deployment

Currently, the company deploys MySQL through platform operations. On Friday, the platform had some problems temporarily. I had an urgent need, so I deployed it manually. Since I haven't deployed the environment for a long time, I'm a little rusty. I record the deployment steps and problems encountered here, hoping it will be helpful to everyone.

1. Generally speaking, there are three common ways to deploy. The first is the yum method, which is the rpm package. The second is the source code method, which is the source code. The third is the binary package, which is the tar.gz format package. You can just unzip it. I use the third method and deploy MySQL version 5.5.19.

2. First, let’s look at the error:

Statement to start the service:
/usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld_safe --defaults=/data/mysql_4310/my.cnf &

 [Note] InnoDB: Waiting for purge to start
 [Note] InnoDB: Percona XtraDB (http://www.percona.com) 5.7.16-10 started; log sequence number 0
 [Note] Plugin 'FEDERATED' is disabled.
20190621_11:25:41mysqld: Table 'mysql.plugin' doesn't exist
 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
 [ERROR] unknown variable 'thread_concurrency=8'
 [ERROR] Aborting

As you can see, two errors are reported. The first is that the mysql.plugin table cannot be opened, and the second error is a parameter error. The parameter thread_concurrency cannot be recognized.

For the second question, it can be confirmed that it is a parameter problem in the configuration file. Because I used the regular 5.7 configuration file and changed several parameters, it is very likely that this parameter was missed and can be changed. Mainly the first question, at this time, I made the following attempts.

3. Solution

Attempt 1: Try restarting

Method using service mysql start:

[root]# service mysql_4310 start
Starting MySQL.....The server quit without updating PID fil[FAILED]/mysql_4310/tmp/mysql.pid).

It is found that the service still cannot be started and the output of the error log remains unchanged.

Attempt 2: See the prompt after the error and run the mysql_upgrade method

[root bin]# ./mysql_upgrade --protocol=tcp -P4310 -p
Enter password: 
Looking for 'mysql' as: ./mysql
Looking for 'mysqlcheck' as: ./mysqlcheck
Running 'mysqlcheck' with connection arguments: '--protocol=tcp' '--port=4310' 
./mysqlcheck: Got error: 2003: Can't connect to MySQL server on 'localhost' (111) when trying to connect

It seems that it still doesn't work. At this time, I seriously suspect that it is a problem with the configuration file:.

Attempt 3: Get a mysql5.5 configuration file from the online environment, then replace the new configuration file and restart:

[root@mysql_4310]# /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld_safe --defaults-file=/data/mysql_4310/my.cnf & 
[1] 63529
[root@mysql_4310]# 190621 11:51:37 mysqld_safe Logging to '/data/mysql_4310/log/hb30_web_wechat_answers-121_246.err'.
190621 11:51:37 mysqld_safe Starting mysqld daemon with databases from /data/mysql_4310/data
190621 11:51:40 mysqld_safe mysqld from pid file /data/mysql_4310/tmp/mysql.pid ended

View the error log:

View the error log:
[Note] Plugin 'FEDERATED' is disabled.
-5.5.19-linux2.6-x86_64/bin/mysqld: Unknown error 1146
[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The InnoDB memory heap is disabled
InnoDB: Mutexes and rw_locks using GCC atomic builtins
InnoDB: Compressed tables use zlib 1.2.3
InnoDB: Using Linux native AIO
InnoDB: Initializing buffer pool, size = 4.0G
InnoDB: Completed initialization of buffer pool
t specified data file /data/mysql_4310/ibdata1 did not exist:
tabase to be created!
 InnoDB: Setting file /data/mysql_4310/ibdata1 size to 1000 MB
 physically writes the file full: wait...
 in MB: 100 200 300 400 500 600 700 800 900 1000
 InnoDB: Data file /data/mysql_4310/ibdata2 did not exist: new to be created
 InnoDB: Setting file /data/mysql_4310/ibdata2 size to 100 MB
 physically writes the file full: wait...
 in MB: 100
og file /data/mysql_4310/innodblog/ib_logfile0 is of different size 0 1073741824 bytes
cified in the .cnf file 0 134217728 bytes!
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Aborting

It was found that a new error appeared at the beginning, indicating that the Innodb initialization function returned an error and the innodb storage engine could not be used. At this point, I began to wonder if there was an error during initialization that caused the service to be unavailable, so I thought about reinitializing the data dictionary and restarting the service to see if it works.

Attempt 4: Reinitialize the data dictionary

I tried to reinitialize using the initialize-insecure method and found that it failed.

[root mysql_4310]# /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld
 --initialize-insecure 
--defaults-file=/data/mysql_4310/my.cnf 
--datadir=/data/mysql_4310/data 
--basedir=/usr/local/mysql-5.5.19-linux2.6-x86_64 &
[1] 7045



[1]+ Exit 2 /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld 
--initialize-insecure 
--defaults-file=/data/mysql_4310/my.cnf 
--datadir=/data/mysql_4310/data 
--basedir=/usr/local/mysql-5.5.19-linux2.6-x86_64

The error log is still the same as before, indicating that the mysql.plugin table does not exist. In addition, there is one more line, as follows:

[ERROR] /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld: unknown option '--initialize-insecure'

So I checked the official document for the --initialize-insecure parameter and found that this parameter does not exist in MySQL version 5.5. The 5.5 version has the initialize parameter, so I changed it to the initialize parameter, reinitialized, and then reported the following error:

[root@ ]/usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld --defaults-file=/data/mysql_4310/my.cnf --datadir=/data/mysql_4310/data --basedir=/usr/local/mysql-5.5.19-linux2.6-x86_64 --initialize &

[1]+ Exit 2 /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld --defaults-file=/data/mysql_4310/my.cnf --datadir=/data/mysql_4310/data --basedir=/usr/local/mysql-5.5.19-linux2.6-x86_64 --initialize

At this point, check the official documentation and find that the MySQL 5.5 version is initialized using the mysql_install_db command instead of the mysqld command. The mysql_install_db tool is not in the /usr/local/mysql-5.5.19-linux2.6-x86_64/bin directory, but in the /usr/local/mysql-5.5.19-linux2.6-x86_64/scripts directory. So use the cp command to copy it to the specified directory and then initialize it, as follows:

[root@mysql_4310]# /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysql_install_db 
--defaults-file=/data/mysql_4310/my.cnf 
[root@mysql_4310]# ll | grep install
[root@mysql_4310]# /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysql_install_db 
--defaults-file=/data/mysql_4310/my.cnf 
--datadir=/data/mysql_4310/data 
--basedir=/usr/local/mysql-5.5.19-linu
[1] 16365
[root@mysql_4310]# 
Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqladmin -u root -h tk01-devt-mysql-7-200 password 'new-password'

Alternatively you can run:
/usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
It is strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql-5.5.19-linux2.6-x86_64 ; /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql-5.5.19-linux2.6-x86_64/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql-5.5.19-linux2.6-x86_64/scripts/mysqlbug script!


[1]+ Done /usr/local/mysql-5.5.19-linux2.6-x86_64/bin/mysql_install_db --defaults-file=/data/mysql_4310/my.cnf --datadir=/data/mysql_4310/data --basedir=/usr/local/mysql-5.5.19-linux2.6-x86_64

The result was successful.

To summarize:

1. MySQL 5.5 version initialization uses the mysql_install_db tool instead of the mysqld tool

2. MySQL 5.5 version initialization uses the --initialize parameter

The above is the details of a problem with MySQL 5.5 deployment. For more information about MySQL deployment, please pay attention to other related articles on 123WORDPRESS.COM!

You may also be interested in:
  • How to install and deploy MySQL 8.0 under CentOS8
  • Example of how to deploy MySQL 8.0 using Docker
  • Implementation of Docker deployment of MySQL cluster
  • Detailed explanation of the process of deploying MySql on Centos server and connecting to Navicat
  • Detailed tutorial on how to compile and install mysql8.0.29 in CentOS8 deployment LNMP environment
  • MySQL 8.0.18 deployment and installation tutorial under Windows 7
  • Detailed steps for remote deployment of MySQL database on Linux
  • Implementation of Docker deployment of Django+Mysql+Redis+Gunicorn+Nginx
  • Detailed explanation of deploying MySQL using Docker (data persistence)
  • Docker deploys mysql to achieve remote connection sample code
  • mysql-8.0.17-winx64 deployment method

<<:  How to collect Nginx logs using Filebeat

>>:  Implementation of deploying Apollo configuration center using docker in CentOS7

Recommend

How to solve the problem that Seata cannot use MySQL 8 version

Possible reasons: The main reason why Seata does ...

Why Use DOCTYPE HTML

You know that without it, the browser will use qui...

Complete steps to build a squid proxy server in linux

Preface This article mainly introduces the releva...

MySQL 8.0 installation tutorial under Linux

This article introduces how to install MySQL 8.0 ...

Detailed explanation of the difference between tags and elements in HTML

I believe that many friends who are new to web pag...

Detailed explanation of Linux mpstat command usage

1. mpstat command 1.1 Command Format mpstat [ -A ...

Linux configuration SSH password-free login "ssh-keygen" basic usage

Table of contents 1 What is SSH 2 Configure SSH p...

Details of Linux file descriptors, file pointers, and inodes

Table of contents Linux--File descriptor, file po...

How does JS understand data URLs?

Table of contents Overview Getting started with d...

How to install theano and keras on ubuntu system

Note: The system is Ubuntu 14.04LTS, a 32-bit ope...

How to set static IP in centOS7 NET mode

Preface NAT forwarding: Simply put, NAT is the us...

When modifying a record in MySQL, the update operation field = field + string

In some scenarios, we need to modify our varchar ...

Solve the problem that Mysql5.7.17 fails to install and start under Windows

Install MySQL for the first time on your machine....

MySql Sql optimization tips sharing

One day I found that the execution speed of a SQL...