查看系统版本
uname -a
cat /etc/issue
联网安装mysql 软件
dpkg -l | grep mysql
sudo apt install mysql-server -y
systemctl status mysql
netstat -ntlp | grep mysql
mysql 启动以后面临的两个问题
- 数据库的登录:密码登录,数据库的远程登录
- 数据库字符集的处理,默认采用utf-8
如果不是root用户的情况下要用sudo ,也可以切换到root用户
无密码登录
sudo mysql -uroot
设置登录密码和远程登录
mysql客户端配置
select host,user,plugin,authentication_string from user;
update user set plugin='mysql_native_password',authentication_string=password('root') where user='root';
grant all on *.* to root@'%' identified by 'root' with grant option;
flush privileges;
mysql配置文件设置
vim /etc/mysql/mysql.conf.d/mysqld.cnf
bind-address = 0.0.0.0
设置mysql数据库的编码
vim /etc/mysql/mysql.conf.d/mysqld.cnf
character_set_server=utf8
|