How to access MySQL from a remote computer (not localhost)?

后端 未结 3 2031
执念已碎
执念已碎 2020-12-04 00:30

I have my dev environment set up as a Ubuntu Server (with LAMP installation) inside a vmware. The vmware is running on my local windows 7 machine. When I try to access my my

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 01:05

    Ok, be aware this gives the world and his dog access to your mysql server.

    GRANT ALL ON *.* to '%'@'%' WITH GRANT OPTION;
    

    But say you are on your home network of 192.168.1.2/16 then you can at least limit it like this.

    GRANT ALL ON *.* to '%'@'192.168.%' WITH GRANT OPTION;
    

    Another option is that you have a user and password but want to connect from anywhere

    GRANT ALL ON *.* to 'mysecretuser'@'%' IDENTIFIED BY 'mysecretpassword' WITH GRANT OPTION;
    

提交回复
热议问题