Install Mysql-Server and Mysql-Clinet under Linux

1. Check if mysql is installed

rpm -qa | grep -i mysql

2. If installed, delete the relevant RPM software package

rpm -e RPM软件包名(该名字是上一个命令查出来的名字)

3. Install the service side

 rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm

If the above reasons occur, it means that the system has already installed other versions of mysql-libs package and mysql database files, causing incompatibility.
You can execute the following command to delete:

yum remove mysql-libs

4. Re-execute the Service installation command

 rpm -ivh MySQL-server-5.6.27-1.el6.x86_64.rpm

The screen of


successful installation : the screen of successful installation but the problem still needs to be solved: the


general problem is that when mysql was installed before, the relevant user group and user name were set, resulting in the default user of mysql cannot be created (but in this case, the installation is also successful , Solve this problem later)

5. Install Mysql-Client

 rpm -ivh MySQL-client-5.6.27-1.el6.x86_64.rpm

The client installation is relatively easy, and there will be no major bugs

6. Check for installation

cat /etc/passwd|grep mysql
cat /etc/group|grep mysql
It can be seen that my user name is not mysql, because the installation time reported a problem that the user name could not be created. Here I changed the user name to root (this is the user name left during the installation of the previous version), and it can be displayed normally . (Follow-up, we will add the username of mysql)

7. Start mysql

service mysql start

Error screen.


At this point, we see the problem and we don’t know what the pid file is. Even if cat goes to view the file, it means that there is no such file. At this time, we can only find the mysql installation directory and view the related log information.

  • Through var/lib/mysql/ above, we can guess the installation directory of mysql
cd /var/lib/mysql

At this point, we can see the .err file with the same name as the above file, this is our error file. Click to view related information.


From the above, we can know that the failure to start is because the mysql user does not exist. At this time, the solution we think of is to add the user name.

useradd mysql

As can be seen from the above, we already have a default group, at this time you must use useradd -g to add users

useradd -g mysql mysql

It will report to you that the permissions are insufficient, at this time we need to modify the relevant permissions

lsattr /etc/passwd
chattr -a /etc/passwd
useradd -g mysql mysql

At this time there is another insufficient authority, we can modify the authority of /etc/shadow

lsattr /etc/shadow
chattr -a /etc/shadow

In this way, the user name was finally added successfully. When we were happy with the service mysql start, we found that it failed to start again. It was


really a fierce operation. Look at the record of 250. At this time, we have to look through the related err file again.


From the related vocabulary above, it is not difficult to find that the related database table is missing.

After searching the information online, I found that the reason why'mysql.plugin' does not exist is because after the newly installed mysql service, it is generally necessary to perform database initialization operations to generate permissions-related tables. The execution commands are as follows:

/usr/bin/mysql_install_db --user=mysql

If the following error is reported, we can install the autoconf library

yum -y install autoconf

After installation, go to perform related installation operations

/usr/bin/mysql_install_db --user=mysql

After the installation is successful, execute the mysql start command again

service mysql start

It can be regarded as clear after rain, our mysql finally started normally