简体   繁体   English

MySQL无法在Ubuntu中重新启动

[英]Mysql not restarting in ubuntu

I am trying to connect my java program in the host OS with the mysql database in the ubuntu VM. 我正在尝试将主机OS中的Java程序与ubuntu VM中的mysql数据库连接。 I have created the necessary tables in the database and changed the bind-address in the my.cnf file to that of the host OS address. 我已经在数据库中创建了必要的表,并将my.cnf文件中的bind-address更改为主机OS地址的bind-address。 While I am trying to restart mysql, I am getting: 当我尝试重新启动mysql时,我得到:

mysql stop/waiting
start: Job failed to start.

Then when I am trying to access mysql, I am getting the following error: 然后,当我尝试访问mysql时,出现以下错误:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' (2)

Please help me with the solution. 请帮我解决。

Simply follow below step to start MySQL server. 只需按照以下步骤启动MySQL服务器。

  • Try to restart MySQL server from terminal. 尝试从终端重启MySQL服务器。 (In RHEL that is /etc/init.d/mysqld restart ) (在RHEL中是/etc/init.d/mysqld restart

Still same issue then follow below step. 仍然是相同的问题,然后执行以下步骤。

  • Rename mysql.sock file with another name eg mysl.sock_old in following directory. 在以下目录中用另一个名称重命名mysql.sock文件,例如mysl.sock_old

    /var/run/mysqld/

Now restart your MySQL server. 现在重新启动MySQL服务器。

I have the same issue with mysql on Ubuntu14.04. 我在Ubuntu14.04上与mysql有相同的问题。 I fixed the issue by commenting configuration in /etc/mysql/my.cnf file. 我通过注释/etc/mysql/my.cnf文件中的配置来解决此问题。

innodb_buffer_pool_size=10G innodb_buffer_pool_size = 10G

innodb_log_file_size=54M innodb_log_file_size = 54M

After commenting mysql service runs well.. 发表评论后,mysql服务运行良好。

Note :- If you comment these configuration then default configuration will take care the size of buffer pool and log file. 注意:-如果您注释这些配置,则默认配置将注意缓冲池和日志文件的大小。 So not any issue . 所以没有任何问题。 But if you want to mention it manually , then provide 80% of your physical memory to buffer pool size. 但是,如果您想手动提及它,那么请提供80%的物理内存来缓冲池大小。 and 25% of buffer pool size to log file. 和25%的缓冲池大小记录到日志文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM