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 startedlog 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
今天在做LNMP环境的时候,mysql启动失败,LNMP环境是用的oneinstack一键安装脚本安装的。大致意思是因为 /tmp 目录缺少启动文件( mysql.pid )导致的,恩,于是参照网上提供的方法,修改 /etc/my.cnf 文件
修改pid文件的存放目录,然后 chmod -R 777 /var/lib/mysql/
重新启动,恩?失败!!
那继续,还有大佬说查看mysql报错日志
等会,好像有什么不对啊,今天明明是11-06,你这个11-04什么鬼!!!!
绝望~
然后冷静下来,想到,刚刚查看日志文件为什么会显示权限不够,什么时候vi都要超级管理员权限了。
然后 ll 看了一下文件的所属
嗯哼,这个1002是什么鬼,顿时发现问题
创建mysql用户和mysql组
nice启动成功了!!!
开心~~
解决方案:1. 找到mysql的data文件夹,将data进行备份,一定要备份!
(data文件夹路径可以在mysql安装目录的my.ini文件中搜索datadir找到)
2.将data文件夹删除
3.用管理员身份打开cmd,进入到mysql的bin目录下,输入命令初始化data文件夹
mysqld --initialize-insecure --user=mysql
等待一定时间,就可以重新初始化数据库,mysql服务也可以启动了
最后利用备份的data文件进行数据的恢复
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)