yancy 发表于 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 AtLUA = Last Unlocked At
WOC = Waiting On ConditionDL = Data Locked
The Event Scheduler is disabled

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

170217 14:44:36InnoDB: Starting shutdown...
170217 14:44:36InnoDB: Shutdown completed; log sequence number 2164196
170217 14:44:36 /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 /usr/local/mysql/bin/mysqld (mysqld 5.5.48-log) starting as process 6681 ...
170217 14:44:37 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:37InnoDB: Waiting for the background threads to start
170217 14:44:38 InnoDB: 5.5.48 started; log sequence number 2164196
170217 14:44:38 Server hostname (bind-address): '0.0.0.0'; port: 3306
170217 14:44:38    - '0.0.0.0' resolves to '0.0.0.0';
170217 14:44:38 Server socket created on IP: '0.0.0.0'.
170217 14:44:38 Event Scheduler: Loaded 0 events
170217 14:44:38 /usr/local/mysql/bin/mysqld: ready for connections.
Version: '5.5.48-log'socket: '/tmp/mysql.sock'port: 3306Source distribution
170217 15:00:56 IP address '222.186.58.35' could not be resolved: Name or service not known
170217 15:12:03 /usr/local/mysql/bin/mysqld: Normal shutdown

170217 15:12:03 Event Scheduler: Purging the queue. 0 events
170217 15:12:03InnoDB: Starting shutdown...
170217 15:12:03InnoDB: Shutdown completed; log sequence number 2164196
170217 15:12:03 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 15:12:03 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 15:12:03 Aborting

170217 15:12:03 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 15:12:12 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 15:12:12 Aborting

170217 15:12:12 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 15:13:53 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 15:13:53 Aborting

170217 15:13:53 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 16:40:24 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 16:40:24 Aborting

170217 16:40:24 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 16:51:31 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 16:51:31 Aborting

170217 16:51:31 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 17:07:57 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 17:07:57 Aborting

170217 17:07:57 /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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170217 17:08:13 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170217 17:08:13 Aborting

170217 17:08:13 /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

licess 发表于 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/ 看一下权限

yancy 发表于 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).

权限:
# 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 mysql18M 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 mysql230 Feb 17 13:24 mysql-bin.000016
-rw-rw---- 1 mysql mysql 133K Feb 17 14:44 mysql-bin.000017
-rw-rw---- 1 mysql mysql14K 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

licess 发表于 2017-2-19 13:52:26

cat /dev/null > /usr/local/mysql/var/mysql-bin.index 后再重启试试,还不行的话发最新的错误日志

yancy 发表于 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 /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 MYSQL_BIN_LOG::open_purge_index_file failed to open registerfile.
170219 19:40:39 MYSQL_BIN_LOG::open_index_file failed to sync the index file.
170219 19:40:39 Aborting

170219 19:40:39 /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上显示:
# cat /den/null > /usr/local/mysql/var/mysql-bin.index
cat: /den/null: No such file or directory
# /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).

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

licess 发表于 2017-2-20 12:32:52

回复 5# 的帖子

cat /dev/null > /usr/local/mysql/var/mysql-bin.index

yancy 发表于 2017-2-20 17:20:42

回复 6# 的帖子

# cat /dev/null > /usr/local/mysql/var/mysql-bin.index
# /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 /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 /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 Aborting

170220 16:56:40 /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版本

licess 发表于 2017-2-20 20:29:28

回复 7# 的帖子

按错误代码是权限问题,再看看磁盘占用情况
重装没法说一定行不行

yancy 发表于 2017-2-20 21:16:20

回复 8# 的帖子

上面发过权限军哥看过有问题么,磁盘也还足够,如果要重装mysql能备份好数据么,怎么备份,还有那个重装mysql的命令是啥呢
# df -l
Filesystem   1K-blocks    Used Available Use% Mounted on
/dev/vda1       20616252 87101441084121245% /
devtmpfs          499212       0    499212   0% /dev
tmpfs             508384       0    508384   0% /dev/shm
tmpfs             508384   57496    45088812% /run
tmpfs             508384       0    508384   0% /sys/fs/cgroup
tmpfs             101680       0    101680   0% /run/user/0

licess 发表于 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

yancy 发表于 2017-2-21 09:38:22

回复 10# 的帖子

那我的1.3要升级到1.4再来重装是把

licess 发表于 2017-2-21 14:04:26

回复 11# 的帖子

只用1.4的安装包

yancy 发表于 2017-2-22 15:01:15

回复 12# 的帖子

确实是权限的问题,是mysql的权限问题,我执行ls -laF /usr/local/mysql/ 查看,mysql拥有者是root,改为mysql,,执行sudo chown -R mysql /usr/local/mysql/,重启成功。
页: [1]
查看完整版本: 军哥帮我看看日志到底那里出错了.