• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

mysql中使用过程中常见错误解决办法收集

mysql 搞代码 4年前 (2022-01-09) 16次浏览 已收录 0个评论

mysql中使用过程中常见错误解决办法收集 大家可参考本文章收藏的错误解决办法。

1、Mysql errono 1005 : 主外键不是完全一致 , 请检查如下几点:

a、字段是否存在
b、类型是否一致(注意unsigned , powerdesign 生成问题)
c、引擎是否一致
d、字符编码是否一致
e、windows平台下注意修改lower_case_table_names = 0, windows本身不区分文件大小写,改为0之后就区分了可能造成找不到引用的表

2、Mysql errono 121来@源gao*daima.com搞@代#码网: 外键约束名称重复

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)
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 root权限
insert into user(host,user,pass) values(‘%’,’root’,PASSWORD(‘root’));
//root 权限授权
grant all privileges on *.* to 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、下安装了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:webwww.php100.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 启动成功


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:mysql中使用过程中常见错误解决办法收集

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址