查看有没有安装MySQL:
dpkg -l | grep mysql
安装MySQL:
apt install mysql-server
安装完成之后可以使用如下命令来检查是否安装成功:
netstat -tap | grep mysql
启动/停止mysql:
service mysql start /stop
现在配置mysql允许远程访问,首先编辑 /etc/mysql/mysql.conf.d/mysqld.cnf 配置文件:
vim /etc/mysql/mysql.conf.d/mysqld.cnf
注释掉bind-address = 127.0.0.1
登录mysql数据库可以通过如下命令:
mysql -u root -p
修改密码
show databases;
use mysql;
update user
set
authentication_string
=
PASSWORD(
"自定义密码"
) where user
=
‘root‘
;
update user
set
plugin
=
"mysql_native_password"
;
flush privileges;
quit;