VPS侦探论坛

 找回密码
 注册
查看: 3193|回复: 12

军哥帮我看看日志到底那里出错了.

[复制链接]
发表于 2017-2-18 01:10:20 | 显示全部楼层 |阅读模式

一开始是因为我写了一段php代码想读取数据库里的IP地址没有的话就保存下来,然后打开页面是errorAccess denied for user 'database'@'localhost' (using password: YES),就搜索论坛看到军哥发的那三个方法,我就自己跟着那些代码输入,# /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart(然后到这一步重启失败,后面有贴图。)
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>

mysql>
然后我就直接关了shell,又重新重启竟然可以重启了,我就再重复这几行代码,到# mysql -u root mysql就失败了,一直到现在都重启不了。
我去找又没找到vultr.guest.pid文件。



日志:
Events status:
LLA = Last Locked At  LUA = Last Unlocked At
WOC = Waiting On Condition  DL = Data Locked
The Event Scheduler is disabled

170217 14:44:36 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown

170217 14:44:36  InnoDB: Starting shutdown...
170217 14:44:36  InnoDB: Shutdown completed; log sequence number 2164196
170217 14:44:36 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 14:44:36 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 14:44:37 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 14:44:37 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 6681 ...
170217 14:44:37 [Note] Plugin 'FEDERATED' is disabled.
170217 14:44:37 InnoDB: The InnoDB memory heap is disabled
170217 14:44:37 InnoDB: Mutexes and rw_locks use GCC atomic builtins
170217 14:44:37 InnoDB: Compressed tables use zlib 1.2.7
170217 14:44:37 InnoDB: Initializing buffer pool, size = 16.0M
170217 14:44:37 InnoDB: Completed initialization of buffer pool
170217 14:44:37 InnoDB: highest supported file format is Barracuda.
170217 14:44:37  InnoDB: Waiting for the background threads to start
170217 14:44:38 InnoDB: 5.5.48 started; log sequence number 2164196
170217 14:44:38 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
170217 14:44:38 [Note]   - '0.0.0.0' resolves to '0.0.0.0';
170217 14:44:38 [Note] Server socket created on IP: '0.0.0.0'.
170217 14:44:38 [Note] Event Scheduler: Loaded 0 events
170217 14:44:38 [Note] /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.48-log'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
170217 15:00:56 [Warning] IP address '222.186.58.35' could not be resolved: Name or service not known
170217 15:12:03 [Note] /usr/local/mysql/bin/mysqld: Normal shutdown

170217 15:12:03 [Note] Event Scheduler: Purging the queue. 0 events
170217 15:12:03  InnoDB: Starting shutdown...
170217 15:12:03  InnoDB: Shutdown completed; log sequence number 2164196
170217 15:12:03 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 15:12:03 mysqld_safe Number of processes running now: 0
170217 15:12:03 mysqld_safe mysqld restarted
170217 15:12:03 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 6971 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 15:12:03 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170217 15:12:03 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170217 15:12:03 [ERROR] Aborting

170217 15:12:03 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 15:12:03 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 15:12:12 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 15:12:12 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 7481 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 15:12:12 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170217 15:12:12 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170217 15:12:12 [ERROR] Aborting

170217 15:12:12 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 15:12:12 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 15:13:53 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 15:13:53 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 8015 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 15:13:53 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170217 15:13:53 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170217 15:13:53 [ERROR] Aborting

170217 15:13:53 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 15:13:53 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 16:40:24 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 16:40:24 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 9211 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 16:40:24 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170217 16:40:24 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170217 16:40:24 [ERROR] Aborting

170217 16:40:24 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 16:40:24 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 16:51:31 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 16:51:31 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 9791 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 16:51:31 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170217 16:51:31 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170217 16:51:31 [ERROR] Aborting

170217 16:51:31 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 16:51:31 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 17:07:57 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 17:07:57 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 10424 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 17:07:57 [ERROR] MYSQL_BIN_LOG::open_purge_index_file failed to open register  file.
170217 17:07:57 [ERROR] MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 17:07:57 [ERROR] Aborting

170217 17:07:57 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 17:07:57 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170217 17:08:13 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170217 17:08:13 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 10924 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170217 17:08:13 [ERROR] MYSQL_BIN_LOG::open_purge_index_file failed to open register  file.
170217 17:08:13 [ERROR] MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 17:08:13 [ERROR] Aborting

170217 17:08:13 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170217 17:08:13 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-18 09:25:12 | 显示全部楼层

回复 1# 的帖子



Access denied for user 'database'@'localhost' (using password: YES) 一般是数据库连接信息错误,你数据库错误里你也不是用的root连接的,上面重置mysql root密码干什么吗?


ls -lh /usr/local/mysql/var/ 看一下权限
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-18 19:26:19 | 显示全部楼层

回复 2# 的帖子


是因为Access denied for user 'database'@'localhost' (using password: YES)打开页面有这个问题,我搜索论坛的解决方法,看到军哥发的三种网上方法,我试了第二种,就是上面发的,现在导致重启mysql失败,一直是ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/vultr.guest.pid).

权限:
[root@vultr ~]# ls -lh /usr/local/mysql/var/
total 388M
drwxr-xr-x 2 mysql mysql 4.0K Feb 17 10:53 database
-rw-rw---- 1 mysql mysql  18M Feb 17 15:12 ibdata1
-rw-rw---- 1 mysql mysql 5.0M Feb 17 15:12 ib_logfile0
-rw-rw---- 1 mysql mysql 5.0M Sep 19 22:01 ib_logfile1
drwx------ 2 mysql mysql 4.0K Feb 16 16:05 ipaddress
drwx------ 2 mysql mysql 4.0K Feb 16 15:42 IPaddress
drwx------ 2 mysql mysql 4.0K Sep 19 22:01 mysql
-rw-rw---- 1 mysql mysql 360M Feb 17 13:13 mysql-bin.000015
-rw-rw---- 1 mysql mysql  230 Feb 17 13:24 mysql-bin.000016
-rw-rw---- 1 mysql mysql 133K Feb 17 14:44 mysql-bin.000017
-rw-rw---- 1 mysql mysql  14K Feb 17 15:12 mysql-bin.000018
-rw-rw---- 1 mysql mysql   76 Feb 17 14:44 mysql-bin.index
drwx------ 2 mysql mysql 4.0K Sep 19 22:01 performance_schema
-rw-r----- 1 mysql root   88K Feb 18 19:24 vultr.guest.err
drwx------ 2 mysql mysql 4.0K Feb 17 14:36 yang
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-19 13:52:26 | 显示全部楼层



cat /dev/null > /usr/local/mysql/var/mysql-bin.index 后再重启试试,还不行的话发最新的错误日志
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-19 22:13:36 | 显示全部楼层

回复 4# 的帖子


日志上显示:
170219 19:40:39 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170219 19:40:39 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 19261 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.~rec~' not found (Errcode: 13)
170219 19:40:39 [ERROR] MYSQL_BIN_LOG:pen_purge_index_file failed to open register  file.
170219 19:40:39 [ERROR] MYSQL_BIN_LOG:pen_index_file failed to sync the index file.
170219 19:40:39 [ERROR] Aborting

170219 19:40:39 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170219 19:40:39 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended


Xshell5上显示:
[root@vultr ~]# cat /den/null > /usr/local/mysql/var/mysql-bin.index
cat: /den/null: No such file or directory
[root@vultr ~]# /etc/init.d/mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/vultr.guest.pid).

是这样输入么,显示没有文件,还是不行

军哥运维代购:http://shop63846532.taobao.com/

发表于 2017-2-20 12:32:52 | 显示全部楼层

回复 5# 的帖子


cat /dev/null > /usr/local/mysql/var/mysql-bin.index
 楼主| 发表于 2017-2-20 17:20:42 | 显示全部楼层

回复 6# 的帖子


[root@vultr ~]# cat /dev/null > /usr/local/mysql/var/mysql-bin.index
[root@vultr ~]# /etc/init.d/mysql restart
ERROR! MySQL server PID file could not be found!
Starting MySQL. ERROR! The server quit without updating PID file (/usr/local/mysql/var/vultr.guest.pid).

日志:
170220 16:40:33 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
170220 16:40:33 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended
170220 16:56:40 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/var
170220 16:56:40 [Note] /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 5412 ...
/usr/local/mysql/bin/mysqld: File './mysql-bin.index' not found (Errcode: 13)
170220 16:56:40 [ERROR] Aborting

170220 16:56:40 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete

170220 16:56:40 mysqld_safe mysqld from pid file /usr/local/mysql/var/vultr.guest.pid ended

删除了bin.index还是出错,重装mysql能解决么,我用的是1.3版本
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-20 20:29:28 | 显示全部楼层

回复 7# 的帖子


按错误代码是权限问题,再看看磁盘占用情况
重装没法说一定行不行
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-20 21:16:20 | 显示全部楼层

回复 8# 的帖子


上面发过权限军哥看过有问题么,磁盘也还足够,如果要重装mysql能备份好数据么,怎么备份,还有那个重装mysql的命令是啥呢
[root@vultr ~]# df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/vda1       20616252 8710144  10841212  45% /
devtmpfs          499212       0    499212   0% /dev
tmpfs             508384       0    508384   0% /dev/shm
tmpfs             508384   57496    450888  12% /run
tmpfs             508384       0    508384   0% /sys/fs/cgroup
tmpfs             101680       0    101680   0% /run/user/0
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-2-21 09:22:30 | 显示全部楼层

回复 9# 的帖子




权限早看了没问题
备份数据库的话现在只能是打包一下数据库目录

1.3的话没法直接重装,可以用1.4的脚本
1.4的话备份好数据库后
rm -rf /usr/local/mysql
rm -f /etc/my.cnf
再 ./install.sh db
 楼主| 发表于 2017-2-21 09:38:22 | 显示全部楼层

回复 10# 的帖子


那我的1.3要升级到1.4再来重装是把
发表于 2017-2-21 14:04:26 | 显示全部楼层

回复 11# 的帖子


只用1.4的安装包
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-2-22 15:01:15 | 显示全部楼层

回复 12# 的帖子

确实是权限的问题,是mysql的权限问题,我执行ls -laF /usr/local/mysql/ 查看,mysql拥有者是root,改为mysql,,执行sudo chown -R mysql /usr/local/mysql/,重启成功。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-11-17 04:43 , Processed in 0.030641 second(s), 17 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表