Mysql启动的方式(四种)
作者:真爱2015 时间:2024-01-28 02:38:53
废话不多说了,直奔主题了。
mysql的四种启动方式:
1、mysqld
启动mysql服务器:./mysqld --defaults-file=/etc/my.cnf --user=root
客户端连接:
mysql --defaults-file=/etc/my.cnf
or
mysql -S /tmp/mysql.sock
2、mysqld_safe
启动mysql服务器:./mysqld_safe --defaults-file=/etc/my.cnf --user=root &
客户端连接:
mysql --defaults-file=/etc/my.cnf
or
mysql -S /tm/mysql.sock
3、mysql.server
cp -v /usr/local/mysql/support-files/mysql.server /etc/init.d/
chkconfig --add mysql.server
启动mysql服务器:service mysql.server {start|stop|restart|reload|force-reload|status}
客户端连接:同1、2
4、mysqld_multi
mkdir $MYSQL_BASE/data2
cat <<-EOF>> /etc/my.cnf
[mysqld_multi]
mysqld = /usr/local/mysql/bin/mysqld_safe
mysqladmin = /user/local/mysql/bin/mysqladmin
user = mysqladmin
password = mysqladmin
[mysqld3306]
port = 3306
socket = /tmp/mysql3306.sock
pid-file = /tmp/mysql3306.pid
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
[mysqld3307]
port = 3307
socket = /tmp/mysql3307.sock
pid-file = /tmp/mysql3307.pid
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data2
EOF
#mysql -S /tmp/mysql3306.sock
mysql>GRANT SHUTDOWN ON *.* TO 'mysqladmin'@'localhost' identified by 'mysqladmin' with grant option;
#mysql -S /tmp/mysql3307.sock
mysql>GRANT SHUTDOWN ON *.* TO 'mysqladmin'@'localhost' identified by 'mysqladmin' with grant option;
启动mysql服务器:./mysqld_multi --defaults-file=/etc/my.cnf start 3306-3307
关闭mysql服务器:mysqladmin shutdown
以上所述是小编给大家介绍了四种Mysql启动方式,希望对大家有所帮助!
标签:mysql,启动,方式
0
投稿
猜你喜欢
使用Python实现大学座位预约功能
2022-03-14 16:26:53
Mysql学习之数据库检索语句DQL大全小白篇
2024-01-24 16:52:39
XML卷之实战锦囊(2):动态查询
2008-09-05 17:20:00
跟老齐学Python之关于循环的小伎俩
2022-07-20 07:03:36
Java使用正则表达式截取重复出现的XML字符串功能示例
2023-02-04 20:44:51
Django+boostrap 美化admin后台的操作
2022-02-26 16:16:21
vue2 设置router-view默认路径的实例
2023-07-02 17:03:02
在kali上安装AWVS的图文教程
2022-12-13 23:58:24
Mysql中mvcc各场景理解应用
2024-01-24 19:29:07
python pandas loc 布尔索引示例说明
2021-02-28 22:43:19
Python tornado队列示例-一个并发web爬虫代码分享
2022-03-13 12:13:55
Python深度学习pytorch神经网络汇聚层理解
2022-08-05 11:57:15
使用Python来编写HTTP服务器的超级指南
2022-12-28 20:40:24
Python抓包并解析json爬虫的完整实例代码
2021-12-17 14:54:32
Python二分查找详解
2023-01-14 16:25:51
Go语言字典(map)用法实例分析【创建,填充,遍历,查找,修改,删除】
2024-05-05 09:30:22
通过Django Admin+HttpRunner1.5.6实现简易接口测试平台
2023-05-24 19:07:45
Django项目中表的查询的操作
2023-04-23 10:22:23
python 每天如何定时启动爬虫任务(实现方法分享)
2022-11-28 21:14:35
在IE 浏览器中使用 jquery的fadeIn() 效果 英文字符字体加粗
2011-06-06 10:28:00