索引:

目录索引

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

参看代码 GitHub:

DeepIn(GNU/Linux) MySQL

一、安装

1 sudo apt-get install mysql-server
2 期间需要输入两次密码,root账户的密码
3 sudo apt-get install mysql-client

二、控制台登陆 

1 mysql -u root -p
2 输入root账户密码就可以登录了
3 quit
4 退出

三、基本编码配置

 1 登陆后
 2 SHOW VARIABLES LIKE 'character%';
 3 默认编码为utf-8 -- 修改/etc/mysql/my.cnf (默认安装路径下) (标签下没有的添加,有的修改)
 4 [mysqld]
 5 character_set_server=utf8
 6 
 7 [mysql]
 8 default-character-set=utf8
 9 
10 [client]
11 default-character-set=utf8

四、服务操作 

1 停止MySQL数据库服务
2 sudo systemctl stop mysql.service
3 启动MySQL数据库服务
4 sudo systemctl start mysql.service
5 重启MySQL数据库服务
6 sudo systemctl restart mysql.service

五、运行状态基本查看

1 查看MySQL运行状态
2 sudo systemctl status mysql.service
3 查看mysqld进程是否开启
4 pgrep mysqld
5 如果进程开启,命令将返回该进程的id。

六、开机自启及服务

1 这里可能chkconfig没有安装,如果是的话 ,则需要安装chkconfig命令
2 sudo apt-get install chkconfig
3 将mysql加入到系统服务
4 chkconfig --add mysql
5 将mysql设置开机启动
6 chkconfig mysql on

 

 

 

 

 

                                         蒙

                                    2018-05-05 23:30 周六

                                    2018-05-11 22:49 周五

 

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄