MySQL problems and solutions during installation and use of Linux

Source: Internet
Author: User


One, the CentOS 7.** version cannot install MySQL; Cause analysis:

MariaDBdatabase management system isMySQL, mainly by the open source community in the maintenance, adoptionGPLLicense. One of the reasons for developing this branch is that Oracle has acquiredMySQLafter that there will beMySQLThe potential risk of a closed source, so the community uses a branching approach to avoid this risk. MariaDBThe purpose is fully compatibleMySQL, includingAPIand command line to make it easy to beMySQLSubstitutes . SoCentOS 7to prevent this potential problem, theMariaDBpackaged for installation as the primary database. So if we re-installMysql, you will be prompted for a conflict or a similar version already exists.

Solution: Uninstall mariadb;

Force uninstallation of all software and associated library information about MARIADB;

1 . View the currently installed MARIADB package:

[[Email protected]]# Rpm-qa | grep mariadb

2, They are all mandatory unloading off:

[Email protected]]# rpm-e--nodeps mariadb-libs-5.5.35-3.el7.x86_64

[Email protected]]# rpm-e--nodeps mariadb-5.5.35-3.el7.x86_64

[Email protected]]# rpm-e--nodeps mariadb-server-5.5.35-3.el7.x86_64

Install MySQL

Method 1, double-click the following three packages for automatic installation:

mysql-client-advanced-5.6.22-1.el7.x86_64.rpm

mysql-devel-advanced-5.6.22-1.el7.x86_64.rpm

mysql-server-advanced-5.6.22-1.el7.x86_64.rpm

( hint: In fact, the second package devel I do not know what to do, do not know whether it is necessary (Internet search should not be necessary), no test whether it must have been ordered to install, and do not want to take the time to test whether it is necessary, Have tested friends trouble message to inform. )

Method 2, install with the RPM command (for. RPM packages)

RPM-IUVH mysql-client-advanced-5.6.22-1.el7.x86_64.rpm

RPM-IUVH mysql-devel-advanced-5.6.22-1.el7.x86_64.rpm

RPM-IUVH mysql-server-advanced-5.6.22-1.el7.x86_64.rpm

Second, MySQL installation has not entered

After installing MySQL , use the command service MySQL start times following error:

error! The server quit without updating PID file

Solution:

this is mainly because: SELinux, if it is a CentOS system, the default is to turn on SELinux. The workaround is to close it, open the/etc/selinux/config, change the selinux=enforcing to selinux=disabled, and then save the restart machine.

Third, no direct access to MySQL

When using the command to enter MySQL, it does not work, reported the following error

[Email protected]]# mysql-u root–p

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Workaround

1, stop the MySQL service;

[[Email protected]]# service MySQL Stop

2, use the Mysql-safe command to bypass password security login;

[Email protected]]# mysqld_safe--user=mysql--skip-grant-tables--skip-networking &

3. Enter the login user name and password

[Email protected]]# mysql-u root–p

4. Reset Password after entering

Mysql>set PASSWORD = PASSWORD (' Passok ')

Note: This is also to prevent another error ERROR 1820 (HY000): Must SET PASSWORD before executing this statement

IV. Remote Management terminal cannot access MySQL

ERROR 1130:host ' 192.168.1.3 ' isn't allowed to connect to this MySQL server

Workaround:

method One, Change Table method :localhost converted to%

go to the MySQL bin directory

[Email protected]]# mysql-u root–p

mysql>usemysql;

Mysql>select ' host ' from user where user= ' root ';

Mysql>updateuser Set host = '% ' where user = ' root ';

Specific statement analysis

1 , after you log in to MySQL , change the "host" entry in the "User" table in the "MySQL" database, changing from "localhost" to '% '. Specific analysis

2 , view the host/IP name of the user table in the MySQL library (which can be accessed by the connection)

3 , modify the host value (increase the hostname/IP address with the wildcard%), or you can add a specific address directly

Note: If ERROR1062 (23000) Occurs when an UPDATE statement is executed : Duplicate entry '%-root ' for key ' PRIMARY ' error, you need to

Selecthost from user where user = ' root ';
Check to see if the host has a% value, and if so, directly execute the following flush privileges;

The code is as follows

Mysql>selecthost,user from user where user= ' root ';

mysql>flushprivileges;

Method 2: Authorization method For example, you want to myuser use mypassword from any host to connect to mysql server words

Use the command: GRANT All privileges on * * to ' myuser ' @ ' percent ' identified by ' MyPassword ' with GRANT OPTION;

if you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password
GRANT all privileges on * * to ' root ' @ ' 192.168.1.3 ' identifiedby ' mypassword ' with GRANT OPTION;

if you want to allow users to connect to the MySQL server from a host myuser IP 192.168.1.3 and use MyPassword as the password

Grantall Privileges On * * to ' root ' @ ' 192.168.3.2 ' identifiedby ' 123456 ' with GRANT OPTION;

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

MySQL problems and solutions during installation and use of Linux

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.