Problems and Solutions during Mysql installation and use in Linux _ MySQL

Source: Internet
Author: User
1. Mysql cannot be installed in CentOS7 **. cause analysis: The MariaDB database management system is a branch of MySQL, which is maintained by the open source community and licensed by GPL. One of the reasons for developing this branch is that after Oracle acquired MySQL

1. Mysql cannot be installed in CentOS 7. **. cause analysis:

The MariaDB database management system is a branch of MySQL. it is mainly maintained by the open-source community and licensed by GPL. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of closing the source of MySQL. Therefore, the community uses the branch method to avoid this risk. MariaDB is designed to be fully compatible with MySQL, including APIs and command lines, so that it can easily become a substitute for MySQL. Therefore, MariaDB has been installed as the primary database on CentOS 7 to prevent this potential problem. In this case, if we install Mysql again, a conflict or a similar version will be displayed.

Solution: uninstall MariaDB;

Forcibly uninstall all software and associated database information about MariaDb;

1,View the currently installed mariadb package:

[Root @ bogon] # rpm-qa | grep mariadb

2. unmount them all forcibly:

[Root @ bogon] # rpm-e-nodeps mariadb-libs-5.5.35-3.el7.x86_64

[Root @ bogon] # rpm-e-nodeps mariadb-5.5.35-3.el7.x86_64

[Root @ bogon] # 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

(Tip: Actually, the second package develI do not know what it is, and do not know whether it is necessary (it should not be necessary to search for the Internet). If I do not test whether it is necessary, I have already installed it, I don't want to take the time to test whether it is necessary or not. if you have any tests, please leave a message to inform me .)

Method 2: Use the rpm command for installation (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

II. unable to enter Mysql after installation

After installing Mysql, run the command service mysql start to report the following error:

ERROR! The server quit without updating PID file

Solution:

This is mainly because:Selinux is triggered by centos. selinux is enabled by default. The solution is to disable it, enable/etc/selinux/config, change SELINUX = enforcing to SELINUX = disabled, and then save the disk and restart the machine.

3. unable to directly access Mysql

The following error is reported if the command does not take effect when entering mysql.

[Root @ bogon] # mysql-u root-p

ERROR 1045 (28000): Access denied for user 'root' @ 'localhost' (using password: YES)

Solution

1. stop the mysql service;

[Root @ bogon] # service mysql stop

2. use the mysql-safe command to bypass secure password logon;

[Root @ bogon] # mysqld_safe -- user = mysql -- skip-grant-tables -- skip-networking &

3. enter the logon user name and password

[Root @ bogon] # mysql-u root-p

4. reset the password after entering

Mysql> set password = PASSWORD ('passok ')

Note: This also prevents another error.ERROR 1820 (HY000): You must set password before executing this statement

4. remote management terminal cannot access Mysql

ERROR 1130: Host '192. 168.1.3 'is not allowed to connect to this MySQL server

Solution:

Method 1,Table change method:Change localhost to %

Enter the BIN directory of mysql

[Root @ bogon] # mysql-u root-p

Mysql> usemysql;

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

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

Statement analysis

1. after logging on to mysql on the local machine, change the "host" entry in the "user" table in the "mysql" database to "%" from "localhost '. Detailed analysis

2. view the host value of the user table in the mysql database (the host/IP name for connection access)

3. modify the host value (adding host/IP addresses with the wildcard % content, of course, you can also directly add a specific IP address

Note: If the error ERROR1062 (23000): Duplicate entry '%-root' for key 'primary' occurs when executing the update statement, you must

Selecthost from user where user = 'root ';
Check whether the host has a value of %. If yes, run the following flush privileges command)

The code is as follows:

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

Mysql> flushprivileges;

Method 2:For example, if you want myuser to use mypassword to connect to the mysql server from any host

Run the following command: grant all privileges on *. * TO 'myuser' @ '% 'identified BY 'mypassword' with grant option;

If you want to allow myuser to connect to the mysql server from a host whose ip address is 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 myuser to connect to the mysql server from a host whose ip address is 192.168.1.3, and use mypassword as the password

Grantall privileges on *. * TO 'root' @ '192. 168.3.2 'identifiedby '123456' with grant option;

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.