Loading... # 0x00 安装 终端输入 ```shell $ sudo apt install -y mysql-server ``` # 0x01 设置root密码 安装完后root默认是没有密码的,但可以使用系统root权限免密码进入数据库 ``` $ sudo mysql -u root ``` 进入后 ```mysql use mysql; update user set plugin='mysql_native_password' where user='root'; update user set password=password('密码') where user='root'; flush privileges; exit; ``` 重启数据库 ``` $ sudo service mysql restart ``` # 0x02 开启远程访问 修改配置 ``` $ sudo nano /etc/mysql/mariadb.conf.d/50-server.cnf 将 bind-address 127.0.0.1 注释掉 $ sudo service mysql restart ``` 进入数据库设置远程登录操作 ```mysql use mysql; grant all privileges on *.* to 'root'@'%' identified by 'root账户密码' with grant option; flush privileges; ``` Last modification:October 24, 2019 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 0 如果觉得我的文章对你有用,请随意赞赏