Chinaunix

标题: 求助,mysql无法启动 [打印本页]

作者: myr    时间: 2009-06-03 23:28
标题: 求助,mysql无法启动
[root@ee mysql]# mysqld start
090603 22:48:02 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=ee-bin' to avoid this problem.
mysqld: Table 'mysql.plugin' doesn't exist
090603 22:48:02 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
InnoDB: Error: auto-extending data file ./ibdata1 is of a different size
InnoDB: 0 pages (rounded down to MB) than specified in the .cnf file:
InnoDB: initial 640 pages, max 0 (relevant if non-zero) pages!
InnoDB: Could not open or create data files.
InnoDB: If you tried to add new data files, and it failed here,
InnoDB: you should now edit innodb_data_file_path in my.cnf back
InnoDB: to what it was, and remove the new ibdata files InnoDB created
InnoDB: in this failed attempt. InnoDB only wrote those files full of
InnoDB: zeros, but did not yet use them in any way. But be careful: do not
InnoDB: remove old data files which contain your precious data!
090603 22:48:02 [ERROR] Plugin 'InnoDB' init function returned error.
090603 22:48:02 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mysqld: Too many arguments (first extra is 'start').
Use --verbose --help to get a list of available options
090603 22:48:02 [ERROR] Aborting
090603 22:48:02 [Warning] Forcing shutdown of 1 plugins
090603 22:48:02 [Note] mysqld: Shutdown complete

这应该怎么办
作者: myr    时间: 2009-06-03 23:32
标题: my.cnf文件内容
# Example MySQL config file for medium systems.
#
# This is for a system with little memory (32M - 64M) where MySQL plays
# an important part, or systems up to 128M where MySQL is used together with
# other programs (such as a web server)
#
# You can copy this file to
# /etc/my.cnf to set global options,
# mysql-data-dir/my.cnf to set server-specific options (in this
# installation this directory is /usr/local/mysql/var) or
# ~/.my.cnf to set user-specific options.
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
# The following options will be passed to all MySQL clients

[client]
default-character-set = utf8
#password       = your_password
port            = 3306

#socket         = /tmp/mysql.sock
socket    = /var/lib/mysql/mysql.sock
# Here follows entries for some specific programs
# The MySQL server
[mysqld]
user = mysql
default-character-set = utf8
port            = 3306
socket          = /usr/local/mysql/lib/mysql.sock
skip-locking
key_buffer = 16M
max_allowed_packet = 1M
table_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
# Don't listen on a TCP/IP port at all. This can be a security enhancement,
# if all processes that need to connect to mysqld run on the same host.
# All interaction with mysqld must be made via Unix sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#
#skip-networking
# Replication Master Server (default)
# binary logging is required for replication
log-bin
# required unique id between 1 and 2^32 - 1
# defaults to 1 if master-host is not set
# but will not function as a master if omitted
server-id       = 1
# Replication Slave (comment out master section to use this)
#
# To configure this host as a replication slave, you can choose between
# two methods :
#
# 1) Use the CHANGE MASTER TO command (fully described in our manual) -
#    the syntax is:
#
#    CHANGE MASTER TO MASTER_HOST=<host>, MASTER_PORT=<port>,
#    MASTER_USER=<user>, MASTER_PASSWORD=<password> ;
#
#    where you replace <host>, <user>, <password> by quoted strings and
#    <port> by the master's port number (3306 by default).
#
#    Example:
#
#    CHANGE MASTER TO MASTER_HOST='125.564.12.1', MASTER_PORT=3306,
#    MASTER_USER='joe', MASTER_PASSWORD='secret';
#
# OR
#
# 2) Set the variables below. However, in case you choose this method, then
#    start replication for the first time (even unsuccessfully, for example
#    if you mistyped the password in master-password and the slave fails to
#    connect), the slave will create a master.info file, and any later
#    change in this file to the variables' values below will be ignored and
  #    overridden by the content of the master.info file, unless you shutdown
#    the slave server, delete master.info and restart the slaver server.
#    For that reason, you may want to leave the lines below untouched
#    (commented) and instead use CHANGE MASTER TO (see above)
#
# required unique id between 2 and 2^32 - 1
# (and different from the master)
# defaults to 2 if master-host is set
# but will not function as a slave if omitted
#server-id       = 2
#
# The replication master for this slave - required
#master-host     =   <hostname>
#
# The username the slave will use for authentication when connecting
# to the master - required
#master-user     =   <username>
#
# The password the slave will authenticate with when connecting to
# the master - required
#master-password =   <password>
#
# The port the master is listening on.
# optional - defaults to 3306
#master-port     =  <port>
#
# binary logging - not required for slaves, but recommended
#log-bin

# Point the following paths to different dedicated disks
#tmpdir         = /tmp/
#log-update     = /path-to-dedicated-directory/hostname
# Uncomment the following if you are using BDB tables
#bdb_cache_size = 4M
#bdb_max_lock = 10000
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/var/
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/var/
#innodb_log_arch_dir = /usr/local/mysql/var/
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
[isamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[myisamchk]
key_buffer = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
bind-address=0.0.0.0

[mysqld_safe]
err_log = /var/log/mysqld.log
#pid_file = /var/run/mysqld.pid
作者: cenalulu    时间: 2009-06-04 00:04
原帖由 myr 于 2009-6-3 23:28 发表
[root@ee mysql]# mysqld start
090603 22:48:02 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master  ...

关键是这句
[ERROR] Can't open the mysql.plugin table.
修改mysql下的data目录的权限,然后再执行
mysql_install_db --datadir=/usr/local/mysql --user=mysql
其中/usr/local/mysql是mysql数据文件存放的位置
作者: 小公猫    时间: 2009-06-04 00:19
日志这么长,没用就别贴出来了,看了都头晕
楼上是牛人~
作者: myr    时间: 2009-06-04 09:14
原帖由 cenalulu 于 2009-6-4 00:04 发表

关键是这句
[ERROR] Can't open the mysql.plugin table.
修改mysql下的data目录的权限,然后再执行
mysql_install_db --datadir=/usr/local/mysql --user=mysql
其中/usr/local/mysql是mysql数据文件存 ...


mysql下没有data目录

还有,我原来有正在使用的数据库,可以在mysql_install_db --datadir=/usr/local/mysql --user=mysql 吗?????
[root@ee mysql]# ll
总用量 40
drwxr-xr-x    2 mysql    root         4096  6月  3 20:14 bin
drwxr-xr-x    2 mysql    root         4096  5月 31 20:24 docs
drwxr-xr-x    3 mysql    root         4096 2005-10-07  include
drwxr-xr-x    2 mysql    root         4096 2005-10-08  info
drwxr-xr-x    3 mysql    root         4096  6月  3 09:42 lib
drwxr-xr-x    2 mysql    root         4096  5月 31 20:25 libexec
drwxr-xr-x    3 mysql    root         4096 2005-10-07  man
drwxr-xr-x   10 mysql    root         4096  5月 31 20:25 mysql-test
drwxr-xr-x    5 mysql    root         4096  5月 31 19:23 share
drwxr-xr-x    5 mysql    root         4096  5月 31 20:25 sql-bench

[ 本帖最后由 myr 于 2009-6-4 09:15 编辑 ]
作者: cenalulu    时间: 2009-06-04 12:34
原帖由 myr 于 2009-6-4 09:14 发表


mysql下没有data目录

还有,我原来有正在使用的数据库,可以在mysql_install_db --datadir=/usr/local/mysql --user=mysql 吗?????
[root@ee mysql]# ll
总用量 40
drwxr-xr-x    2 mysql    ro ...


那也就是说你做的是升级mysql的操作咯?
那就按照提示所说的[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
运行一下mysql_upgrade,具体的参数可以man一下。

还有[ERROR] Do you already have another mysqld server running on socket: /usr/local/mysql/lib/mysql.sock ?
你没有把原来的那个数据库关掉?就执行更新操作了?
作者: myr    时间: 2009-06-04 12:54
[root@ee root]# mysql_install_db --datadir=/usr/local/mysql/var --user=mysql
Installing MySQL system tables...
090604 11:59:51 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=ee-bin' to avoid this problem.
ERROR: 1036  Table 'db' is read only
090604 11:59:52 [ERROR] Aborting
090604 11:59:52 [Warning] Forcing shutdown of 2 plugins
090604 11:59:52 [Note] /usr/sbin/mysqld: Shutdown complete

Installation of system tables failed!  Examine the logs in
/usr/local/mysql/var for more information.
You can try to start the mysqld daemon with:
    shell> /usr/sbin/mysqld --skip-grant &
and use the command line tool /usr/bin/mysql
to connect to the mysql database and look at the grant tables:
    shell> /usr/bin/mysql -u root mysql
    mysql> show tables
Try 'mysqld --help' if you have problems with paths.  Using --log
gives you a log in /usr/local/mysql/var that may be helpful.
The latest information about MySQL is available on the web at
http://www.mysql.com/.  Please consult the MySQL manual section
'Problems running mysql_install_db', and the manual section that
describes problems on your OS.  Another information source are the
MySQL email archives available at http://lists.mysql.com/.
Please check all of the above before mailing us!  And remember, if
you do mail us, you MUST use the /usr/bin/mysqlbug script!
作者: myr    时间: 2009-06-04 12:59
原帖由 cenalulu 于 2009-6-4 12:34 发表


那也就是说你做的是升级mysql的操作咯?
那就按照提示所说的[ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
运行一下mysql_upgrade,具体的参数可以man一下。

还 ...


老大,我是帮别人看,我对mysql不太会
开始问题好像是硬盘没有空间了
然后被人把数据库移走了,包括错误日志
后来又然装了一个mysql,位置在/use/local/mysql2
现在搞不好了,我接手了
作者: cenalulu    时间: 2009-06-04 15:34
那也就是说你有现成的数据库文件,只是新装了一个mysql?
那么你至少要把my.cnf里的datadir 配置到原来的数据文件夹的位置。

还有就是你新装的mysql版本跟原来一样么?
作者: myr    时间: 2009-06-04 16:17
新装了一个,路径还不一样,版本不知道一样不
作者: Coolriver    时间: 2009-06-04 16:18
LZ估计就是想装一个MySQL在/usr/local/mysql2 下。

你在my.cnf 中声明一下:
[mysqld]
basedir=/usr/local/mysql2
datadir=/usr/local/mysql/var
作者: myr    时间: 2009-06-04 16:31
还是不行

090604 15:54:41 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
090604 15:54:42 [Warning] No argument was provided to --log-bin, and --log-bin-index was not used; so replication may break when this MySQL server acts as a master and has his hostname changed!! Please use '--log-bin=ee-bin' to avoid this problem.
/usr/local/mysql2/libexec/mysqld: Table 'plugin' is read only
090604 15:54:42 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
090604 15:54:42 [ERROR] Can't start server : Bind on unix socket: Permission denied
090604 15:54:42 [ERROR] Do you already have another mysqld server running on socket: /usr/local/mysql/lib/mysql.sock ?
090604 15:54:42 [ERROR] Aborting

090604 15:54:42 [Note] /usr/local/mysql2/libexec/mysqld: Shutdown complete

090604 15:54:42 mysqld_safe mysqld from pid file /usr/local/mysql/var/ee.xjtu.edu.cn.pid ended
作者: cenalulu    时间: 2009-06-04 17:52
你的mysql数据文件到底存在哪??
/var/lib/mysql  ?
/usr/local/mysql/var ??
作者: myr    时间: 2009-06-04 21:30
老大,我详细的给你说一下整个过程

开始在5月底的时候,数据库出现错误,不可以正常启动(我后来查看错误日志,发现是磁盘空间不够引起的错)
别人把数据库移动到了一个地方(具体哪里我忘记了),这时候数据库还是不可以启动(当然了),
然后就重新安装mysql到/usr/local/mysql2(这时候数据库还没有好,我开始接手),(他不知道那个环节备份过一个my.cnf)

开始的错误提示好像是权限问题
在my.cnf中加入user=mysql,问题解决
然后出现这个错误提示(开始的那个)

我恢复my.cnf文件
把数据库,移回/usr/local/mysql/var
整个过程差不多就这样

/var/lib/mysql下也有文件,文件的日期是6月3日,也就是他安装mysql到/usr/local/mysql2的时候

其实,我的目的很简单,把正在使用的数据库可以正常使用就行了

可以重新安装mysql,然后像sqlserver一样把数据库文件加载上去就可以了

或者像sybase一样,建好库,然后把database文件一替换

[ 本帖最后由 myr 于 2009-6-4 21:49 编辑 ]
作者: cenalulu    时间: 2009-06-05 10:41
首先,如果你决定以后就一直用mysql2的话,最好var文件别放原来的mysql下。

然后你check下面几项吧。
1. ps aux|grep mysql
看看有没有在跑的进程
2. 看一下 /usr/local/mysql2/var  的权限 (我的建议是把var放这里或者放/var/lib/mysql 下)
如果你的系统有mysql帐户的话,最好把这个文件夹的owner改成mysql。
3. 把你的my.cnf贴一下
你的有些设置还是跟原来那个数据库有关联,总之很混乱
作者: 聪明笨小孩    时间: 2009-06-05 10:49
/usr/local/mysql/bin/mysqld_safe  --defaults-file=/etc/my2.cnf   --user=mysql &
作者: myr    时间: 2009-06-05 11:07
原帖由 cenalulu 于 2009-6-5 10:41 发表
首先,如果你决定以后就一直用mysql2的话,最好var文件别放原来的mysql下。

然后你check下面几项吧。
1. ps aux|grep mysql
看看有没有在跑的进程
2. 看一下 /usr/local/mysql2/var  的权限 (我的建议是 ...



1、没有mysql进程

2、看一下 /usr/local/mysql2/var  的权限 的权限没有问题

3、mc.cnf的内容就是2楼那个
作者: myr    时间: 2009-06-05 11:08
原帖由 聪明笨小孩 于 2009-6-5 10:49 发表
/usr/local/mysql/bin/mysqld_safe  --defaults-file=/etc/my2.cnf   --user=mysql &



etc下没有my2.cnf
作者: cenalulu    时间: 2009-06-05 12:50
原帖由 myr 于 2009-6-5 11:07 发表



1、没有mysql进程

2、看一下 /usr/local/mysql2/var  的权限 的权限没有问题

3、mc.cnf的内容就是2楼那个


my.cnf 修改这么几项

socket    = /usr/local/mysql2/mysql.sock
datadir = /usr/local/mysql2/var
basedir = /usr/local/mysql2
作者: Coolriver    时间: 2009-06-05 14:30
另外,LZ 以前启动MySQL也是:
#mysqld start
???不知道是不是可行?

我的推荐的方法是:
/usr/local/mysql/libexec/mysqld  --defaults-file=/etc/my.cnf  &
#user = mysql 添加到[mysqld] 中。
作者: cenalulu    时间: 2009-06-05 14:43
原帖由 Coolriver 于 2009-6-5 14:30 发表
另外,LZ 以前启动MySQL也是:
#mysqld start
???不知道是不是可行?

我的推荐的方法是:
/usr/local/mysql/libexec/mysqld  --defaults-file=/etc/my.cnf  &
#user = mysql 添加到[mysqld] 中。

其实我比较纠结的是LZ为什么要搞两个mysql。
原来mysql不是能够运行么,只是空间不够,现在够了为什么还要弄个mysql2出来
作者: myr    时间: 2009-06-06 01:54
我也不知道,开始的时候不是我弄得,别人弄不好了,找的我
作者: rainbow    时间: 2009-06-09 09:52
哎,这个搞的太乱了。




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2