Ignoring query to other database
【報錯原因】
登陸數據庫缺少參數
[root@localhost ~]# mysql -root -p
【解決方法】
補全的參數,整句話意思是使用root用戶去登陸密碼為000000
[root@localhost ~]# mysql -uroot -p000000
【錯誤示例】
[root@localhost ~]# mysql -root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 21 Server version: 5.5.48-log Source distribution Copyright (c) 2000, 2016, 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> show databases; Ignoring query to other database mysql> Ctrl-C -- exit! Aborted
【解決示例】
[root@localhost ~]# mysql -uroot -p000000 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) [root@localhost ~]# mysql -uroot -p123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23 Server version: 5.5.48-log Source distribution Copyright (c) 2000, 2016, 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> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | test | +--------------------+ 4 rows in set (0.00 sec)
ERROR:No query specified
【報錯原因】
sql語句后加“;”
mysql> select * from user \G;
【解決方法】
sql語句后不加“;”
mysql> select * from user \G
【錯誤示例】
【解決示例】
ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
【報錯原因】
語句中的password是不需要的
【解決方法】
去掉password
【錯誤示例】
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY PASSWORD '000000' WITH GRANT OPTION ; ERROR 1372 (HY000): Password hash should be a 41-digit hexadecimal number
【解決示例】
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '000000' WITH GRANT OPTION ; Query OK, 0 rows affected (0.00 sec)
2003 - can't connect to MySQL server on 'xxxxx'(10060 "Unknown error")
ssh可以正常登陸,ssh訪問通過mysql命令可以進入數據庫,使用Navicat連接報錯
【報錯原因】
防火牆問題,使用的是oneinstack一鍵安裝工具這個會自己給你安裝iptables
【解決方法】
service iptables stop
Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY'
【報錯原因】
主鍵沒有設置自動增長
【解決方法】
將主鍵設為自動增長
General error: 1030 Got error 28 from storage engine
【報錯原因】
服務器磁盤滿啦
【解決方法】
刪除不必要的日志文件或者增加磁盤
1241 - Operand should contain 1 column(s)
【報錯原因】
這個語句的出現多是因為將select 的結果集用()包住了。
WHERE UNIX_TIMESTAMP(w.create_time ) between (1569254400,1569859199)
【解決方法】
WHERE UNIX_TIMESTAMP(w.create_time ) between 1569254400 AND 1569859199
1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'a.msg_type' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by
【報錯原因】
mysql版本的問題,5.7.27版本
【解決辦法】
MySQL [mysql]> set global sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; Query OK, 0 rows affected (0.00 sec) MySQL [mysql]> set session sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION'; Query OK, 0 rows affected (0.00 sec)
Data too long for column 'matter' at row 1
【報錯原因】
1數據庫表里面的字段長度過少(我是這個原因)
【解決辦法】
設置為255,解決了
mysqldump: [Warning] Using a password on the command line interface can be insecure.
【報錯原因】
mysql5.7版本,安全機制做了改變,直接寫不行了
【解決辦法】
vi /etc/my.cnf [client] port = 3306 socket = /tmp/mysql.sock host = 127.0.0.1 user = root password = password
重新載入配置文件
service mysqld reload
運行命令
/usr/local/mysql/bin/mysqldump --defaults-extra-file=/etc/my.cnf -R -E -e --all-databases | gzip > $backupdir/database_$date_str.sql.gz
General error: 1030 Got error 28 from storage engine
【報錯原因】
服務器磁盤滿了
【解決辦法】
1. 擴容磁盤
2. 清除日志文件
SQLSTATE[HY093]: Invalid parameter number: parameter was not defined
【報錯原因】
PHP查詢綁定參數的問題
【解決辦法】
//問號占位符
Db::query("select * from think_user where id=? AND status=?", [8, 1]);
// 命名綁定
Db::execute("update think_user set name=:name where status=:status", ['name' => 'thinkphp', 'status' => 1]);