服务器是阿里的centOS8+
1: yum install mysql
2:yum install mysql-server
3: yum install mysql-devel
4: service mysqld start
5: 进入到安装目录:/usr/bin 下执行 mysql -u root -p
提示初始化密码: 输入密码 再次确认密码即可
6:开启远程访问:ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
刷新:flush privileges;
root@localhost 是本地访问,修改的话需要
切换数据库:use mysql
查看:select host from user where user='root';
host 对应的是localhost的话需要修改成%
执行: update user set host = '%' where user ='root';
刷新:flush privileges;