mysql配置root账户允许远程连接

GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
把上文中的username和password改为你想要远程登录的用户名和密码,username一般为root
select host, user from user;
查看用户名和对应允许登录的ip
%代表可以允许所有ip进行登录

最后一步
刷新权限
FLUSH PRIVILEGES;
完成后不需要重启mysql服务,即可在别的ip进行登录

后续新增:
linux下mysql表名大小写敏感问题:

  在服务运行目录找到my.ini或者my.cnf文件

  [mysqld]增加一行

  lower_case_table_names=0 (0:区分;1:不区分大小写)

附:centos离线安装mysql8

CentOS7离线安装MySQL8.0

本文链接:https://blog.csdn.net/a332056918/article/details/87803901
  1. 下载tar包 https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

  2. yum install -y lrzsz

  3. 在/usr/local目录下新建目录mysql
    cd /usr/local
    mkdir mysql

  4. 在/usr/local/mysql目录下使用rz -be命令上传mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

  5. tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
    得到文件如图:在这里插入图片描述

  6. rpm -qa | grep mariadb 命令查看 mariadb 的安装包

  7. rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps 卸载mariadb

  8. 再次执行6查看

  9. rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安装 common

  10. 依次: libs,client,server

  11. rpm -qa | grep mysql
    在这里插入图片描述

  12. 初始化
    mysqld --initialize;
    [root@1234 mysql]# mysqld --initialize;
    mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    yum install -y libaio安装依赖

    mysqld --initialize;
    chown mysql:mysql /var/lib/mysql -R;
    systemctl start mysqld;

  13. cat /var/log/mysqld.log | grep password查看密码

  14. 登录后修改密码:
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

  15. 授权
    create user 'root'@'%' identified with mysql_native_password by '123456';
    grant all privileges on *.* to 'root'@'%' with grant option;
    flush privileges;

posted @ 2020-06-24 17:07  某某混子,名不虚传  阅读(496)  评论(0编辑  收藏  举报