首先我要说我是一个mysql新手。 基本上mysql没有启动并说:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)
现在,以下是我毁掉一切的步骤:
由于无法登录我的系统(otrs),我认为恢复较旧的备份会有所帮助。
在恢复过程中,备份管理器说我需要删除旧的数据库。我尝试了但是过程没有完成,所以我取消了它。
在此之后我尝试重新启动系统但是遇到了很大的问题但是当我完成重启后我试图运行mysql但是它说它找不到mysql.socket。
此时我认为重新安装mysql会更好,但这样做没有用。 当试图启动mysqld作为mysql用户时,它说:
[ERROR] Found 1 prepared transactions! It means that mysqld was not shut down properly last time and critical recovery information (last binlog or tc.log file) was manually deleted after a crash. You have to start mysqld with --tc-heuristic-recover switch to commit or rollback pending transactions.
尝试两者都没有帮助:
mysql:/root> /usr/sbin/mysqld --tc-heuristic-recover commit
131213 16:46:00 InnoDB: The InnoDB memory heap is disabled
131213 16:46:00 InnoDB: Mutexes and rw_locks use GCC atomic builtins
131213 16:46:00 InnoDB: Compressed tables use zlib 1.2.7
131213 16:46:00 InnoDB: Using Linux native AIO
131213 16:46:00 InnoDB: Initializing buffer pool, size = 128.0M
131213 16:46:00 InnoDB: Completed initialization of buffer pool
131213 16:46:00 InnoDB: highest supported file format is Barracuda.
131213 16:46:01 InnoDB: Waiting for the background threads to start
131213 16:46:02 Percona XtraDB (http://www.percona.com) 5.5.33-MariaDB-31.1 started; log sequence number 3710898915
131213 16:46:02 [Note] Server socket created on IP: '0.0.0.0'.
131213 16:46:02 [ERROR] Event Scheduler: Failed to open table mysql.event
131213 16:46:02 [ERROR] Event Scheduler: Error while loading from disk.
131213 16:46:02 [Note] Event Scheduler: Purging the queue. 0 events
131213 16:46:02 [ERROR] Aborting
131213 16:46:02 InnoDB: Starting shutdown...
131213 16:46:03 InnoDB: Shutdown completed; log sequence number 3710898915
131213 16:46:03 [Note] /usr/sbin/mysqld: Shutdown complete
运行systemctl start mysql.service随时失败:
mysql.service - LSB: Start the MySQL database server
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: timeout) since Fri, 13 Dec 2013 16:27:12 +0100; 23min ago
Process: 8845 ExecStart=/etc/init.d/mysql start (code=killed, signal=TERM)
CGroup: name=systemd:/system/mysql.service
Dec 13 16:31:21 mysql[8845]: otrs.user_preferences OK
Dec 13 16:31:21 mysql[8845]: otrs.users OK
Dec 13 16:31:21 mysql[8845]: otrs.valid OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs_db OK
Dec 13 16:31:21 mysql[8845]: otrs.virtual_fs_preferences OK
Dec 13 16:31:21 mysql[8845]: otrs.web_upload_cache OK
Dec 13 16:31:21 mysql[8845]: otrs.xml_storage OK
Dec 13 16:31:21 mysql[8845]: performance_schema
Dec 13 16:31:21 mysql[8845]: Phase 3/3: Running 'mysql_fix_privilege_tables'...
我完全不知道该怎么做。谁能帮助我? 如何在不使用mysql DROP命令的情况下删除/删除otrs表? 无论如何这会有所帮助吗?
谢谢。
答案 0 :(得分:12)
mysqld --tc-heuristic-recover=ROLLBACK
我没有为我做神奇的事。但是以下工作
mysqld_safe --tc-heuristic-recover=COMMIT
答案 1 :(得分:6)
我能够使用
在CentOS 6上克服这个问题service mysql start --tc-heuristic-recover=ROLLBACK
最终放弃了有问题的提交。我不确定systemd脚本是否支持传递其他参数。也许您可以尝试使用=
mysqld --tc-heuristic-recover=ROLLBACK
答案 2 :(得分:2)
在mysql 5.6.x上,由于这个一个一个https://bugs.mysql.com/bug.php?id=70860的错误,我可以通过这样做来解决这个问题
sudo service mysql start --tc-heuristic-recover=0
可能会提交tx。
答案 3 :(得分:1)
来自->> https://www.youtube.com/watch?v=qr-t8ksYO78
的答案转到my.cnf文件,请注意,您将找到多个my.cnf文件,我必须查看所有文件才能找到此文件->
# The MySQL server
[mysqld]
user = mysql
port=3306
socket = /opt/lampp/var/mysql/mysql.sock
复制套接字路径并将其写为->
mysql -u root -p --socket=/opt/lampp/var/mysql/mysql.sock
谢谢