我的mysql是安装在/usr/local/mysql目录下,bin/mysqld_safe --user=mysql &启动后,从日志文件中发现如下错误:
- 110623 21:49:41 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
- 110623 21:49:41 [ERROR] Can't find messagefile '/usr/share/errmsg.sys'
- 110623 21:49:41 [Warning] Can't create test file /var/lib/mysql/ubuntu.lower-test
- 110623 21:49:41 [Warning] Can't create test file /var/lib/mysql/ubuntu.lower-test
- /usr/local/mysql/bin/mysqld: Can't change dir to '/var/lib/mysql/' (Errcode: 2)
- 110623 21:49:41 [ERROR] Aborting
从日志上发现,mysql的启动目录不对。
修改启动命令:
sudo mysqld_safe --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql &
即可启动成功:
110623 21:49:41 [Note]
110623 21:49:41 mysqld_safe mysqld from pid file /var/lib/mysql/ubuntu.pid ended
110623 21:57:21 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data/
110623 21:57:21 InnoDB: The InnoDB memory heap is disabled
110623 21:57:21 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110623 21:57:21 InnoDB: Compressed tables use zlib 1.2.3.3
110623 21:57:21 InnoDB: Initializing buffer pool, size = 128.0M
110623 21:57:21 InnoDB: Completed initialization of buffer pool
110623 21:57:21 InnoDB: highest supported file format is Barracuda.
110623 21:57:21 InnoDB: Waiting for the background threads to start
110623 21:57:22 InnoDB: 1.1.7 started; log sequence number 1607993
110623 21:57:22 [Note] Event Scheduler: Loaded 0 events
110623 21:57:22 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.13' socket: '/var/run/mysqld/mysqld.sock' port: 3306 Source distribution