Linux系统安装MySQL报错

Linux系统安装MySQL报错,第1张

在Linux下面安装 MySQL的时候出现了错误:

33.Transaction Check Error:

34. file /usr/share/mysql/charsets/README from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

35. file /usr/share/mysql/charsets/Index.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

36. file /usr/share/mysql/charsets/armscii8.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

37. file /usr/share/mysql/charsets/ascii.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

38. file /usr/share/mysql/charsets/cp1250.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

39. file /usr/share/mysql/charsets/cp1251.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

40. file /usr/share/mysql/charsets/cp1256.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

41. file /usr/share/mysql/charsets/cp1257.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

42. file /usr/share/mysql/charsets/cp850.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

43. file /usr/share/mysql/charsets/cp852.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

44. file /usr/share/mysql/charsets/cp866.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

45. file /usr/share/mysql/charsets/dec8.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

46. file /usr/share/mysql/charsets/geostd8.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

47. file /usr/share/mysql/charsets/greek.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

48. file /usr/share/mysql/charsets/hebrew.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

49. file /usr/share/mysql/charsets/hp8.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

50. file /usr/share/mysql/charsets/keybcs2.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

51. file /usr/share/mysql/charsets/koi8r.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

52. file /usr/share/mysql/charsets/koi8u.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

53. file /usr/share/mysql/charsets/latin1.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

54. file /usr/share/mysql/charsets/latin2.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

55. file /usr/share/mysql/charsets/latin5.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

56. file /usr/share/mysql/charsets/latin7.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

57. file /usr/share/mysql/charsets/macce.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

58. file /usr/share/mysql/charsets/macroman.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

59. file /usr/share/mysql/charsets/swe7.xml from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

60. file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

61. file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

62. file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

63. file /usr/share/mysql/english/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

64. file /usr/share/mysql/estonian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

65. file /usr/share/mysql/french/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

66. file /usr/share/mysql/german/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

67. file /usr/share/mysql/greek/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

68. file /usr/share/mysql/hungarian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

69. file /usr/share/mysql/italian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

70. file /usr/share/mysql/japanese/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

71. file /usr/share/mysql/korean/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

72. file /usr/share/mysql/norwegian-ny/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

73. file /usr/share/mysql/norwegian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

74. file /usr/share/mysql/polish/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

75. file /usr/share/mysql/portuguese/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

76. file /usr/share/mysql/romanian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

77. file /usr/share/mysql/russian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

78. file /usr/share/mysql/serbian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

79. file /usr/share/mysql/slovak/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

80. file /usr/share/mysql/spanish/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

81. file /usr/share/mysql/swedish/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

82. file /usr/share/mysql/ukrainian/errmsg.sys from install of MySQL-server-community-5.1.58-1.rhel5.i386 conflicts with file from package mysql-libs-5.1.52-1.el6_0.1.i686

在网上找了一下,原来是包冲突,conflicts英文就是冲突的意思,呵呵,英文很烂

我把那些冲突 的包全部卸载;

yum -y remove mysql-libs-5.1.52*-y的意思就是不用询问是否remove

卸载完成之后,再安装MySQL成功了,呵呵

yum install MySQL-server-community-5.1.58-1.rhel5.i386.rpm

一、无法访问系统资源

MySQL 不能访问启动需要的资源是造成而 MySQL 无法启动的一个常见原因,如:文件,端口等。由于 linux 中用于启动 mysqld 进程的 mysql 用户通常是不能登陆的,可以使用类似下面的命令检查文件的访问权限。

sudo -u mysql touch /var/lib/mysql/b

找出问题后,修改对应文件或目录的权限或属主后通常可以解决问题。但有时 mysql 用户有访问文件和目录的权限,但仍然会被拒绝访问,例如下面这个例子:

mysql>system sudo -u mysql touch /home/mysql/data/a

mysql>create table t1 (

id int primary key,n varchar(10

) data directory

ERROR 1030 (HY000): Got error 168 from storage engine

测试说明 mysql 用户有这个目录的访问权限,但创建文件还是失败,这种情况让很多人困惑,这个时候通常是 mysqld 进程的访问被 linux 的 selinux 或 apparmor 给阻止了,大家可以看到创建的表不是在 mysql 的默认目录下面,因此 selinux 或 apparmor 的 policy 里面没有包含这个目录的访问权限,此时只要对应的修改 policy 就行了,当然把 selinux 或 apparmor 停了也行。

有时虽然对系统资源有访问的权限,但系统资源已经被占用:

mysqld --no-defaults --console --user mysql

2020-11-03T03:36:07.519419Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 21171

2020-11-03T03:36:07.740347Z 1 [ERROR] [MY-012574] [InnoDB] Unable to lock ./ibdata1 error: 11

这个故障产生的原因是另外一个 mysqld 进程已经启动并占用了对应的文件。

二、参数设置错误

参数设置错误造成 MySQL 无法启动的原因也非常常见,此时先要检查 MySQL 启动时会调用的参数,下面的命令可以查询 MySQL 启动时调用参数文件的顺序:

$ mysqld --verbose --help | grep "Default options " -A 1

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf ~/.my.cnf

知道了 MySQL 参数文件的调用顺序,我们就可以检查对应的参数文件,找出其中的错误,如果觉得参数文件的可读性不强,可以使用下面的命令显示 mysqld 程序将要调用的参数:

$ mysqld --print-defaults

/usr/sbin/mysqld would have been started with the following arguments:

......

注意这个命令显示完参数后就退出,不会真正运行 mysqld。这个命令和 my_print_defaults mysqld 完全是等价的,只不过后者的显示方式是一行一个参数。

然后开始对可疑的参数进行调试,我个人喜欢加的参数和顺序如下:

1. 在 mysqld 后加上第一个参数 --no-defaults ,这个参数的作用是通知 mysqld 在启动的时候不要读任何参数文件;

2. 第二个参数是 --console,这个参数会把错误信息输出到屏幕上,这个参数带来的一个弊端是所有的信息都输出到屏幕上,让屏幕显得比较乱,但对于我们调试却是很方便的;

3. 第三个参数是 --log-error-verbosity=3,这个参数会显示详细的日志;

4. 然后再在后面加上有把握的参数,可以一次只加一个参数,然后启动 mysqld,采用排除法逐步找出错误的参数。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5947172.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-09
下一篇 2023-03-09

发表评论

登录后才能评论

评论列表(0条)

保存