Raspberry PI开启 MySQL (Mariadb) 远程访问

Raspberry PI开启 MySQL (Mariadb) 远程访问

 

  1. 修改配置文件

    root@PISRV01:~# cd /etc/mysql

    root@PISRV01:/etc/mysql# ls

    conf.d debian.cnf debian-start mariadb.cnf mariadb.conf.d my.cnf my.cnf.fallback

    root@PISRV01:/etc/mysql# cd mariadb.conf.d

    root@PISRV01:/etc/mysql/mariadb.conf.d# ls

    50-client.cnf 50-mysql-clients.cnf 50-mysqld_safe.cnf 50-server.cnf

    root@PISRV01:/etc/mysql/mariadb.conf.d# nano 50-server.cnf

     

    bind-address = 127.0.0.1

    改为

    bind-address = 0.0.0.0

     

     

 

  1. 进入mysql(MariaDB)添加运程访问数据库用户

     

    GRANT ALL PRIVILEGES ON *.* TO ‘dba’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION;

    FLUSH PRIVILEGES;

     

 

  1. 重启数据库

    root@PISRV01:~# service mysqld restart

     

  2. 使用MySql Workbench 连接测试

     

    测试通过

Leave a Comment