MySQL Common error resolution method

Source: Internet
Author: User

One: Login error

ERROR 1045 (28000): Access denied for user ' mysql ' @ ' localhost ' (using Password:no) MySQL log file The overall steps to summarize this problem are as follows: First step: Modify the PID path to view the log file error message: cat/var/log/mysqld.log2013-10-26 16:39:34 3712 [ERROR]/usr/sbin/ Mysqld:can ' t create/write to file '/var/run/mysqld/mysqld.pid ' (Errcode:2-No such file or directory) 2013-10-26 16:39:3 4 3712 [ERROR] Can ' t start server:can ' t create PID file:no such file or directory cause: The MySQL user does not have permission to operate the/var/run directory, so the PID files cannot be created Built, resulting in the login process can not be set up information files, login process can not be opened, nature can not login. FIX: Modify/etc/my.conf Original: #pid-file=/var/run/mysqld/mysqld.pid modified to pid-file=/var/lib/mysql/ The Mysqlid.pid check found that MySQL users simply could not CD to/var/run/. Change to MySQL can have permissions to the directory after the execution of MySQL into the database. Step Two: Modify the database default password/etc/init.d/mysql stop    (service mysqld stop)/usr/bin/mysqld_safe-- Skip-grant-tables also open an SSH connection [[email protected] ~]# mysqlmysql>use mysqlmysql>update user Set password= Password ("123456") where user= "root"; Mysql>flush privileges;mysql>exit then [[email protected] etc]$ ps-a | grep mysql4532 pts/0    00:00:00 mysqld_safe5542 pts/0    00:00:00 mysqld[[email protected] etc]$ kill-9 4532 5542 normal start mysql:/etc/init.d/mysql s tart    (Service mysqld start) Step three: Login OK. Mysql-uroot-p two: Telnet mysql database error 1130 (HY000): Host ' 192.168.76.50 ' is not allowed to connect to this MySQL server1. Change table Method. It may be that your account is not allowed to log on remotely, only on localhost. This time, as long as the computer on the localhost, log in to MySQL, change the "MySQL" Database in the "User" table "host" item, from "localhost" to "%" mysql-u root-ptalent123mysql> Use Mysql;mysql>update user set host = '% ' where user = ' root '; mysql>select host, user from user;mysql> flush pri Vileges;2. Authorization law. For example, if you want to myuser use MyPassword to connect to a MySQL server from any host. GRANT all privileges on * * to ' myuser ' @ '% ' identified by ' MyPassword ' with GRANT OPTION; If you want to allow users to MyUser from IP to 192.168.1.3 host Receive MySQL server and use MyPassword as password GRANT all privileges on * * to ' myuser ' @ ' 192.168.1.3 ' identified by ' MyPassword ' with GRANT OP tion; three: Unable to log on locally after creating a normal user [[email protected] ~] #mysql-h192.168.76.73-usalt-psalterror 1045 (28000): Access denied For user ' salt ' @ ' JCFX-4 ' (using Password:yes) finds a null password for localhost by looking at the user table, so this is the root cause of the inability to log on locally:mysql> select Host,user,password from Mysql.user Solution:mysql> Grant Select,insert,update,delete on salt.* to [email protected] "localhost" identified By "salt"; Query OK, 0 rows affected (0.01 sec) mysql> flush privileges; Query OK, 0 rows Affected (0.00 sec) Four: MySQL login error: [[[email protected] bin]# Mysql-bash:mysql:command not found workaround: ln -s/usr/local/mysql/bin/mysql/usr/bin Five: Set character set server version:5.6.21 Mysqlcharacter_set_server=utf8 Note: If you encounter an exception, The methods enumerated above should be solved;

How to troubleshoot common errors in MySQL

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.