安装mysql成功 但是/var/lib/mysql 文件目录下是空的 ,没有 mysql test

lilinew 2009-06-24 03:30:07
centos (linux )下 yum命令安装mysql成功 (安装时间长,下载相关软件都成功
客户端 服务器软件都成功)
但是发现
var/lib/mysql 文件目录下是空的 ,没有 mysql test目录 (这是很不正常的 ,如果没看mysql,将无法启动),也没有socket。
(本台机器环境比较复杂,之前装mysql ,后来删掉安装myslq集群,之后又删除集群 )



所以我用 mysql -hlocalhost -uroot -p
报错误 eeror 2002(HY000) can't connect to local myslq serer. through socket '/var/lib/mysql/mysql.sock'
换--protocal=tcp 还是抱mysql.sock错误
这个很奇怪 ,为 什么mysql下面会没哟数据或者目录啦?? (安装没有报错误 )

...全文
6786 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
RichardSzwz 2011-05-25
  • 打赏
  • 举报
回复
我也遇到了同样的问题!不知道是什么原因,请指点迷津,
运行bin/mysql_install_db --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data后提示:
-bash: bin/mysql_install_db: 没有那个文件或目录
ACMAIN_CHM 2009-06-24
  • 打赏
  • 举报
回复

datadir=/var/lib/mysql

如果这个目录下什么都没有,则说明安装并没有完成。

1。在你的文件系统中找一下 user.frm
find / -name "user.frm" -print
如果有,则这个目录中应该有user.*等文件。到my.cnf中把datadir 改到这个目录中试一下。

2。如果没有,则需要用 mysql_install_db 命令来创建这些系统表。
shell> bin/mysql_install_db --user=mysql --basedir=/opt/mysql/mysql --datadir=/opt/mysql/mysql/data
改成你自己的目录即可。
lilinew 2009-06-24
  • 打赏
  • 举报
回复
/var/log/mysqld.log
its content is like this:

090603 17:21:48 mysqld ended

090622 22:00:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
090622 22:00:59 [Warning] The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
090622 22:00:59 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
090622 22:00:59 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
090622 22:00:59 InnoDB: Started; log sequence number 0 46409
090622 22:00:59 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
090622 22:00:59 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
090623 15:21:43 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
090623 15:21:45 [Warning] The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
090623 15:21:45 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
090623 15:21:46 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
090623 15:21:47 InnoDB: Started; log sequence number 0 46409
090623 15:21:47 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
090623 15:21:47 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
090623 20:33:27 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
090623 20:33:28 [Warning] The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
/usr/sbin/mysqld: Table 'mysql.plugin' doesn't exist
090623 20:33:28 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: The log sequence number in ibdata files does not match
InnoDB: the log sequence number in the ib_logfiles!
090623 20:33:28 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
090623 20:33:29 InnoDB: Started; log sequence number 0 46409
090623 20:33:29 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
090623 20:33:29 mysqld_safe mysqld from pid file /var/lib/mysql/localhost.localdomain.pid ended
lilinew 2009-06-24
  • 打赏
  • 举报
回复
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
ACMAIN_CHM 2009-06-24
  • 打赏
  • 举报
回复

检查一下你的 /etc/my.cnf 的内容,贴出来看一下。

56,803

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧