Linux MySQL常见问题小结 FAQ

来源:互联网 发布:网络劫持 编辑:程序博客网 时间:2024/06/11 03:04



问题1:

[root@Tony_ts_tian bin]# mysqladmin -uroot password 'kaka123'
mysqladmin: connect to server at 'localhost' failed
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)'
[root@Tony_ts_tian bin]# MySQL
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@Tony_ts_tian bin]# mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: YES)

问题1.1:

发现mysql数据库下user表中,Host和User为两个主键列。

mysql> update user set host='%' where user='root';
ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

解决1 (7:忘记密码):

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. [root@Tony_ts_tian bin]# service mysqld stop   
  2. Shutting down MySQL.. SUCCESS!   
  3. [root@Tony_ts_tian bin]# mysqld_safe --user=root --skip-grant-tables --skip-networking &  
  4. [1] 30273  
  5. [root@Tony_ts_tian bin]# 151013 15:40:40 mysqld_safe Logging to '/var/lib/mysql/Tony_ts_tian.err'.  
  6. 151013 15:40:40 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql  

注:--skip-grant-tables 启动mysql时不启动grant-tables,授权表

       --skip-networking关闭MySQL的TCP/IP连接方式,跳过网络

注:不要关闭上个终端,再次打开一个终端。
执行以下指令:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. root@Tony_ts_tian init.d]# mysql -u root  
  2. mysql> use mysql  
  3. mysql> UPDATE user SET Password=PASSWORD('kaka321') where USER='root';  
  4. mysql> flush privileges;  
  5. mysql> quit  
  6. [root@Tony_ts_tian bin]# service mysqld start  
  7. [root@Tony_ts_tian bin]# service mysqld restart  
  8. [root@Tony_ts_tian bin]# mysql -u root -p  
  9. Enter password:  
  10. ………………ok.  

或者:

[sql] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. UPDATE `userSET Host='%' WHERE Host='127.0.0.1' AND User='root'  

注:也可使用:/etc/mysql/debian.cnf文件中[client]下配置的密码。

问题2:

mysql> use mysql
ERROR 1820 (HY000): You must SET PASSWORD before executing this statement

解决2:

[sql] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. mysql> SET PASSWORD = PASSWORD('kaka321');  
  2. Query OK, 0 rows affected (0.00 sec)  

修改后继续使用。
问题3:

mysql> INSERT INTO mysql.user(Host,User,Password) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"));
ERROR 1364 (HY000): Field 'ssl_cipher' doesn't have a default value
mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"),"");
ERROR 1364 (HY000): Field 'x509_issuer' doesn't have a default value
mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"),"","");
ERROR 1364 (HY000): Field 'x509_subject' doesn't have a default value
mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"),"","");
ERROR 1364 (HY000): Field 'x509_subject' doesn't have a default value

解决3:

[sql] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"),"","","");  
  2. Query OK, 1 row affected (0.03 sec)  

问题4:

 ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'weloveshare'

解决4:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. [root@Tony_ts_tian bin]# mysql -u root -p;  
  2. Enter password:   
  3. Welcome to the MySQL monitor.  Commands end with ; or \g.  
  4. Your MySQL connection id is 7  
  5. Server version: 5.1.73 Source distribution  
  6.   
  7. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.  
  8.   
  9. Oracle is a registered trademark of Oracle Corporation and/or its  
  10. affiliates. Other names may be trademarks of their respective  
  11. owners.  
  12.   
  13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  
  14.   
  15. mysql> 密码正确,就可以登录了.  

问题5:

C compiler on this system is: cc 
Cannot find appropriate C++ compiler on this system.
configure: error: no acceptable C compiler found in $PATH

解决5:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. apt-get install gcc build-essential  
问题6:

configure: error: no acceptable m4 could be found in $PATH.

解决6:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. ftp://ftp.gnu.org/gnu/m4/  
  2. apt-get install m4  
问题7:

make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
ubuntu version: Ubuntu 14.04 LTS

解决7:

1:要么磁盘存储空间不足,一版5.6的大概30G左右!

2:安装:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. apt-get install bison  

问题8:

make && make install
The program 'make' is currently not installed. You can install it by typing:

解决8:

[plain] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. apt-get install make  
问题9:

mysql启动失败!

root@server:/usr/local/mysql/support-files# ./mysql.server start
Starting MySQL
... * The server quit without updating PID file (/data/mysql.pid).

解决9:

1:my.cnf 配置文件配置错误!参考!

2:安装完后,可能重启下系统,可选建议!

3:mysql源码编译问题!

0 0