Deepin下安装Mysql

一.打开终端(Alt+Ctrl+T):

sudo apt-get install mysql-server mysql-client

安装过程中会需要输入root账号的密码,输入密码后,等待安装完成即可

二.设置MySql:

1.将mysql加入到系统服务

chkconfig --add mysql

2.将mysql设置开机启动

chkconfig mysql on

3.注意:在这里可能chkconfig没有安装,如果是的话 ,则需要安装chkconfig命令:

sudo apt-get install chkconfig

三.登陆MySql

1.查看数据库当前编码:

SHOW VARIABLES LIKE 'character%';

2.修改默认编码为utf-8:

修改/etc/mysql/my.cnf (默认安装路径下) (标签下没有的添加,有的修改)

 [mysqld]

 character_set_server=utf8

 [mysql]

 default-character-set= utf8

3.查询的一些命令

       停止MySQL数据库服务:

sudo systemctl stop mysql.service

  启动MySQL数据库服务:

sudo systemctl start mysql.service

  重启MySQL数据库服务:

sudo systemctl restart mysql.service

  查看MySQL运行状态:

sudo systemctl status mysql.service


猜你喜欢

转载自www.cnblogs.com/chenzhaoyu/p/9219672.html