mysql中使用過程中常見錯誤解決辦法收集,大家可參考本文章收藏的錯誤解決辦法.
1、Mysql errono 1005:主外鍵不是完全一致,請檢查如下幾點:
a、字段是否存在
b、類型是否一致(注意unsigned , powerdesign 生成問題)
c、數據庫引擎是否一致
d、字符編碼是否一致
e、windows平臺下注意修改lower_case_table_names = 0,windows本身不區分文件大小寫,改為0之后就區分了可能造成找不到引用的表
2、Mysql errono 121:外鍵約束名稱重復.
3、記錄 Mysql WorkBench 中單詞縮寫意義:
- PK: primary key (column is part of a pk)
- NN: not null (column is nullable)
- UQ: unique (column is part of a unique key)
- AI: auto increment (the column is auto incremented when rows are inserted) --Vevb.com
- BIN: binary (if dt is a blob or similar, this indicates that is binary data, rather than text)
- UN: unsigned (for integer types, see docs: “10.2. Numeric Types”)
- ZF: zero fill (rather a display related flag, see docs: “10.2. Numeric Types”)
4、mysql 權限設置
- //添加遠程主機訪問MYSQL root權限
- insert into user(host,user,password) values('%','root',PASSWORD('root'));
- //root 權限授權
- grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
- //更新權限設置
- flush privileges;
5、防火墻設置
- //打開端口
- /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
- //保存
- /etc/rc.d/init.d/iptables save
- //查看狀態
- /etc/init.d/iptables status
6、開機自動運行(實現類似Windows服務).
- /sbin/chkconfig --level 2345 mysqld on
- /sbin/chkconfig --list
- 結果如下:
- mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
7、linux下安裝了mysql,不能從其它機器訪問,帳號已經授權從任意主機進行訪問.
vi /etc/sysconfig/iptables:在后面添加:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
service iptables restart
發現還是不行,最終發現記錄要添加在:-A RH-Firewall-1-INPUT -p icmp --icmp-type any -j ACCEPT 這一條前面 再次重啟 OK
8、忘記mysql密碼
- Microsoft Windows [版本 5.2.3790]
- (C) 版權所有 1985-2003 Microsoft Corp.
- C:Documents and SettingsAdministrator>cd D:webwww.php100.comMysqlMySQL Se
- rver5.5bin
- C:Documents and SettingsAdministrator>d:
- D:webwww.php100.comMysqlMySQL Server5.5bin>mysql
- Welcome to the MySQL monitor. Commands end with ; or g.
- Your MySQL connection id is 1
- Server version: 5.5.10 MySQL Community Server (GPL)
- Copyright (c) 2000, 2010, 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> use mysql;
- Database changed
- mysql> update user set password=password("520") where user="root";
- Query OK, 1 row affected (0.00 sec)
- Rows matched: 1 Changed: 1 Warnings: 0
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
- mysql> q
- Bye
- D:webm.survivalescaperooms.comMysqlMySQL Server5.5bin>
9、mysql 2003錯誤解決辦法
MySQL 服務器資源緊張,導致無法連接.
解決方法:
1、如果你是虛擬主機用戶(購買的空間),則聯系空間商檢查 MySQL 是否正常啟動,并確認 MySQL 的配置信息(是否為 localhost);
2、如果你是獨立主機用戶(擁有管理主機權限),則按下面步驟檢查:
1)檢查是否啟動了 MySQL 服務.
Windows 主機的話,右鍵點擊我的電腦,單擊管理,在服務和應用程序中找到 MySQL 服務,看是否是已啟動的狀態.
如果出現"ERROR 2003: Can't connect to MySQL server on 'localhost' (10061)", 說明你的MySQL還沒有啟動.
解決辦法:
第一步,刪除c:windowns下面的my.ini.
第二步,打開c:mysqlbinwinmysqladmin.exe 輸入用戶名 和密碼.
第三步 在dos下 輸入 mysqld-nt -remove 刪除服務.
在接著輸入 mysqld-nt -install.
第四步 輸入mysql 啟動成功.
新聞熱點
疑難解答