start and stop mysql_MySQL学习笔记2-System administration(STOP or START MySQL)

START MYSQL

[root@localhost bin]# service mysql start

Starting MySQL.. SUCCESS!

[root@localhost bin]# ps -ef | grep mysql

root      5548     1  0 22:00 pts/2    00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.localdomain.pid

mysql     5651  5548  7 22:00 pts/2    00:00:01 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin --user=mysql --log-error=/var/lib/mysql/localhost.localdomain.err --pid-file=/var/lib/mysql/localhost.localdomain.pid

root      5692  3327  0 22:01 pts/2    00:00:00 grep mysql

[root@localhost bin]# cat /var/lib/mysql/localhost.localdomain.err

151117 22:00:53 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

2015-11-17 22:00:54 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2015-11-17 22:00:54 0 [Note] /usr/sbin/mysqld (mysqld 5.6.27) starting as process 5651 ...

2015-11-17 22:00:54 5651 [Note] Plugin 'FEDERATED' is disabled.

2015-11-17 22:00:54 5651 [Note] InnoDB: Using atomics to ref count buffer pool pages

2015-11-17 22:00:54 5651 [Note] InnoDB: The InnoDB memory heap is disabled

2015-11-17 22:00:54 5651 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2015-11-17 22:00:54 5651 [Note] InnoDB: Memory barrier is not used

2015-11-17 22:00:54 5651 [Note] InnoDB: Compressed tables use zlib 1.2.3

2015-11-17 22:00:54 5651 [Note] InnoDB: Using Linux native AIO

2015-11-17 22:00:54 5651 [Note] InnoDB: Not using CPU crc32 instructions

2015-11-17 22:00:54 5651 [Note] InnoDB: Initializing buffer pool, size = 128.0M

2015-11-17 22:00:54 5651 [Note] InnoDB: Completed initialization of buffer pool

2015-11-17 22:00:54 5651 [Note] InnoDB: Highest supported file format is Barracuda.

2015-11-17 22:00:54 5651 [Note] InnoDB: 128 rollback segment(s) are active.

2015-11-17 22:00:54 5651 [Note] InnoDB: Waiting for purge to start

2015-11-17 22:00:54 5651 [Note] InnoDB: 5.6.27 started; log sequence number 1625987

2015-11-17 22:00:54 5651 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 9e7e6458-8d33-11e5-a647-000c29ac69e3.

2015-11-17 22:00:54 5651 [Note] Server hostname (bind-address): '*'; port: 3306

2015-11-17 22:00:54 5651 [Note] IPv6 is available.

2015-11-17 22:00:54 5651 [Note]   - '::' resolves to '::';

2015-11-17 22:00:54 5651 [Note] Server socket created on IP: '::'.

2015-11-17 22:00:54 5651 [Note] Event Scheduler: Loaded 0 events

2015-11-17 22:00:54 5651 [Note] /usr/sbin/mysqld: ready for connections.

Version: '5.6.27'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

[root@localhost bin]# cat /var/lib/mysql/localhost.localdomain.pid

5651

[root@localhost bin]# ls -ltr /var/lib/mysql

总用量 110624

drwxr-xr-x. 2 mysql mysql     4096 11月 17 21:33 test

-rw-rw----. 1 mysql mysql 50331648 11月 17 21:33 ib_logfile1

drwx------. 2 mysql mysql     4096 11月 17 21:33 performance_schema

drwx--x--x. 2 mysql mysql     4096 11月 17 21:33 mysql

-rw-r--r--. 1 mysql mysql      125 11月 17 21:33 RPM_UPGRADE_MARKER-LAST

-rw-r--r--. 1 root  root       125 11月 17 21:33 RPM_UPGRADE_HISTORY

-rw-rw----. 1 mysql mysql       56 11月 17 22:00 auto.cnf

srwxrwxrwx. 1 mysql mysql        0 11月 17 22:00 mysql.sock

-rw-rw----. 1 mysql mysql        5 11月 17 22:00 localhost.localdomain.pid

-rw-r-----. 1 mysql root      2112 11月 17 22:00 localhost.localdomain.err

-rw-rw----. 1 mysql mysql 12582912 11月 17 22:00 ibdata1

-rw-rw----. 1 mysql mysql 50331648 11月 17 22:00 ib_logfile0

[root@localhost bin]#

STOP MYSQL

<<<<

mysqld_safe has no server shutdown capability. You can use mysqladmin shutdown instead. Note that if you forcibly terminate mysqld by using the kill -9 command to send it a signal, then mysqld_safe detects that mysqld terminated abnormally and restarts it. You can work around this by killing mysqld_safe first and then killing mysqld, but it is better to use mysqladmin shutdown, which initiates a normal (clean) server shutdown.

<<<<

[root@localhost bin]# service mysql stop

Shutting down MySQL.. SUCCESS!

[root@localhost bin]#

<<< or

[root@localhost ~]# mysqladmin shutdown mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user 'root'@'localhost' (using password: NO)' [root@localhost ~]# mysqladmin -uroot -pmysql shutdown Warning: Using a password on the command line interface can be insecure. [root@localhost ~]# ps -ef | grep mysql root      6112  6073  0 23:46 pts/4    00:00:00 grep mysql [root@localhost ~]#

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
"Failed to start LSB: start and stop MySQL"错误信息表明MySQL无法成功启动。这个错误可能由多种原因引起,其中之一是权限问题。你可以检查MySQL的data目录的权限设置,确保MySQL有足够的权限来读取和写入该目录。另外,你还可以查看MySQL的配置文件,确认配置文件中的权限设置是否正确。如果你仍然遇到问题,你可以尝试以下方法来解决该错误: 1. 检查MySQL服务的状态:使用命令`systemctl status mysql`来查看MySQL服务的状态,如果服务没有运行,请尝试启动MySQL服务:`systemctl start mysql`。 2. 检查MySQL配置文件:查看MySQL的配置文件(通常是`/etc/mysql/my.cnf`或`/etc/my.cnf`),确保配置文件中的路径和权限设置正确。 3. 检查MySQL日志:查看MySQL的日志文件(通常是`/var/log/mysql/error.log`),查找任何与启动错误相关的信息。 4. 检查MySQL进程:使用命令`ps -ef | grep mysql`来检查是否有正在运行的MySQL进程。如果有,请尝试终止该进程,然后重新启动MySQL服务。 5. 重启服务器:如果上述方法都无效,你可以尝试重启服务器,有时候重启可以解决一些临时性的问题。 请注意,以上是一些常见的解决方法,具体解决方法可能因情况而异。如果问题仍然存在,请提供更多的详细信息,以便进一步帮助您解决该问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [MySQL启动报错: Failed to start LSB: start and stop MySQL.](https://blog.csdn.net/firstcode666/article/details/121782924)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [MySQL启动报错: Failed to start LSB start and stop MySQL](https://blog.csdn.net/jiong9412/article/details/123676332)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [undefined](undefined)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值