Linux下Mysql启动、关闭、重启指令

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44085635

[[email protected] ~]# rpm -qa|grep -i mysql

--查询linux系统中是否安装mysql数据库

mysql-devel-5.1.66-2.el6_3.x86_64

perl-DBD-MySQL-4.013-3.el6.x86_64

mysql-5.1.66-2.el6_3.x86_64

mysql-server-5.1.66-2.el6_3.x86_64

qt-mysql-4.6.2-25.el6.x86_64

mysql-libs-5.1.66-2.el6_3.x86_64

You have new mail in /var/spool/mail/root

[[email protected] ~]# /etc/init.d/mysqldstart

--启动mysql,也可以使用命令:service mysqld start

Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h master.cloudera password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:

cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
                                                              [  OK  ]
Starting mysqld:                                              [  OK  ]

[[email protected] ~]# /usr/bin/mysqladmin -u root password root

--设置root密码

[[email protected] ~]# mysql -u [email protected]

--登陆到mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 5.1.66 Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

mysql>quit

补充:

[[email protected] ~]# /etc/inint.d/mysqld stop

--停止mysql,也可以使用命令:service mysqld stop

[[email protected] ~]# /etc/inint.d/mysqld restart

--重启mysql,也可以使用命令:service mysqld restart

原创作品,出自 “深蓝的blog” 博客,欢迎转载,转载时请务必注明以下出处,否则追究版权法律责任。

深蓝的blog:http://blog.csdn.net/huangyanlong/article/details/44085635

时间: 2024-12-05 05:28:13

Linux下Mysql启动、关闭、重启指令的相关文章

Linux下Redis启动/关闭/重启服务脚本

脚本功能: 实现redis单机多实例情况下的正常启动.关闭.重启单个redis实例.完成系统标准服务的以下常用功能:  start|stop|status|restart 注:redis程序代码屏蔽了HUP信号,不支持在线重载配置文件,故去掉reload功能. 本脚本优化了redis停止和重启逻辑,解决原redis脚本关闭时会造成数据丢失问题. 脚本名称: redis           #在多实例里可以按实例端口,如:redis-6001命名,以区分不同实例 脚本用法: 1.在/etc/rc.

linux下mysql启动与停止

mysql.启动与停止   1.启动   MySQL安装完成后启动文件mysql在/etc/init.d目录下,   在需要启动时运行下面命令即可.   [[email protected] init.d]# /etc/init.d/mysql start   2.停止 /usr/bin/mysqladmin -u root -p shutdown   3.自动启动   1)察看mysql是否在自动启动列表中   [[email protected] local]# /sbin/chkconfi

linux下nginx启动停止重启控制脚本

这是控制nginx服务的脚本文件,包括控制nginx的启动.重启.停止.平滑重启.对配置文件的额检查. [[email protected] ~]# cat nginx.sh #!/bin/env bash # description:nginx server   ###必须加描述 # nginx - this script is used to control nginx service # processname nginx # chkconfig: - 85 15 # edit by su

linux下如何启动/停止/重启mysql:

一.启动方式1.使用linux命令service 启动:service mysqld start2.使用 mysqld 脚本启动:/etc/inint.d/mysqld start3.使用 safe_mysqld 启动:safe_mysqld& 二.停止1.使用 service 启动:service mysqld stop2.使用 mysqld 脚本启动:/etc/inint.d/mysqld stop3. mysqladmin shutdown 三.重启1.使用 service 启动:serv

Linux 下 MySQL 启动与关闭 说明

转自:http://www.cnblogs.com/springside-example/archive/2011/11/29/2529604.html 一.启动 1.1  MySQL 进程 可以用ps 命令查看进程: [[email protected]2 ~]# ps -ef|grep mysql root     2161     1  0 09:38 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe--datadir=/var/lib/mysq

解决Linux下MySQL启动错误Starting MySQL.Manager of pid-file quit without updating file.[FAILED]

刚装完MySQL,启动时报如下错误: Starting MySQL.Manager of pid-file quit without updating file.[FAILED] 依次尝试了从谷歌找到的各种方法,发现只要执行如下MySQL初始化命令即可解决: /usr/local/mysql/bin/mysql_install_db --user=mysql 下面附上从谷歌找到的解决此问题的方法集锦,也许每个人遇到的问题的原因会不一样,经供参考: 一.查看报错日志 报错日志是我们解决问题的方向灯

Linux 平台MySQL启动关闭方式总结

MySQL的启动方法有很多种,下面对比.总结这几种方法的一些差异和特性,下面实验的版本为MySQL 5.6.如有疏漏或不足,敬请指点一二. 1:使用mysqld启动.关闭MySQL服务 mysqld是MySQL的守护进程,我们可以用mysqld来启动.关闭MySQL服务,关于mysqld, MySQL 5.6官方介绍资料如下所示: mysqld, also known as MySQL Server, is the main program that does most of the work

linux下MySQL停止和重启

一.启动方式1.使用linux命令service 启动:service mysqld start2.使用 mysqld 脚本启动:/etc/inint.d/mysqld start3.使用 safe_mysqld 启动:safe_mysqld& 二.停止1.使用 service 启动:service mysqld stop2.使用 mysqld 脚本启动:/etc/inint.d/mysqld stop3. mysqladmin shutdown 三.重启1.使用 service 启动:serv

linux下mysql 启动命令

1,使用service 启动.关闭MySQL服务 service mysql start service mysql stop service mysql restart 运行上面命令,其实是service命令去找/etc/init.d下的相关的mysql脚本去执行启动.关闭动作. 2,使用/etc/init.d/mysql启动.关闭MySQL服务, [[email protected] bin]# /etc/init.d/mysql start Starting MySQL....[  OK 

Linux下Mysql启动异常排查方案

遇到Mysql启动异常问题,可以从以下几个方面依次进行问题排查: (1)如果遇到“Can't connect to local MySQL server through socket '/tmp/mysql.sock'”类似问题,查看Mysql配置文件(默认在/etc/my.cnf目录下),使用命令vi /etc/my.cnf,查看是否具备如下配置, [mysqld]port            = 3306socket       = /var/lib/mysql/mysql.sock 可能