MySQL配置和設置典型問題小結

http://blog.csdn.net/typa01_kk/article/details/49107407

問題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:忘記密碼):或者MYSQL拒絕訪問

先打開一個centos終端,輸入如下命令

[root@Tony_ts_tian bin]# service  mysqld  stop   

Shutting down MySQL.. SUCCESS!   

[root@Tony_ts_tian bin]# mysqld_safe --user=root --skip-grant-tables --skip-networking &  

[1] 30273  

[root@Tony_ts_tian bin]# 151013 15:40:40 mysqld_safe Logging to '/var/lib/mysql/Tony_ts_tian.err'.  

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連接方式,跳過網絡

注:不要關閉上一個終端,再次打開一個終端。


執行以下指令:

root@Tony_ts_tian init.d]# mysql -u  root  

mysql>use mysql  

mysql>UPDATE user SET Password=PASSWORD('kaka321') where USER='root';  

mysql>flush privileges;  

mysql>quit  

[root@Tony_ts_tian bin]# service mysqld start  

[root@Tony_ts_tian bin]# service mysqld restart  

[root@Tony_ts_tian bin]# mysql -u root -p  

Enter password:  

………………ok.

或者:

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:

mysql> SET PASSWORD = PASSWORD('kaka321');

Query OK, 0 rows affected (0.00 sec) 

修改後繼續使用。

問題3:

mysql> INSERT INTOmysql.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 INTOmysql.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 INTOmysql.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 INTOmysql.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

mysql> INSERT INTO mysql.user(Host,User,Password,ssl_cipher,x509_issuer,x509_subject) VALUES("10.155.123.55","kaka",PASSWORD("kaka123"));  

Query OK, 1 row affected (0.03 sec)  

問題4:

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

解決4

[root@Tony_ts_tian bin]# mysql -u root -p;  

Enter password:   

Welcome to the MySQL monitor.  Commands end with ; or \g.  

Your MySQL connection id is 7  

Server version: 5.1.73 Source distribution  

  Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.  

  Oracle is a registered trademark of Oracle Corporation and/or its  

affiliates. Other names may be trademarks of their respective  

owners.  

  Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.  

  mysql> 密碼正確,就可以登錄了.  

問題5:

C compiler on this system is: cc 

Cannot find appropriate C++ compiler onthis system.

configure: error: no acceptable C compilerfound in $PATH

解決5

apt-get install gcc build-essential  

問題6:

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

解決6

ftp://ftp.gnu.org/gnu/m4/  

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:安裝:

apt-get install bison  

問題8:

make && make install

The program 'make' is currently not installed. You caninstall it by typing:

解決8:

apt-get install make  

問題9:

mysql啓動失敗!

root@server:/usr/local/mysql/support-files# ./mysql.server  start

Starting MySQL

... * Theserver quit without updating PID file (/data/mysql.pid).

解決9:

1:my.cnf配置文件配置錯誤!參考

2:安裝完後,可能重啓下系統,可選建議!

3:mysql源碼編譯問題!



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章