bitnami@linux:~$ sudo find / -name my.cnf [sudo] password for bitnami: /opt/bitnami/mysql/my.cnf bitnami@linux:~$
註釋掉這一行php
[mysqladmin] user=root [mysqld] basedir=/opt/bitnami/mysql datadir=/opt/bitnami/mysql/data port=3306 socket=/opt/bitnami/mysql/tmp/mysql.sock tmpdir=/opt/bitnami/mysql/tmp max_allowed_packet=16M #bind-address=127.0.0.1 character-set-server=UTF8 collation-server=utf8_general_ci [mysqld_safe] mysqld=mysqld.bin [client] port=3306 socket=/opt/bitnami/mysql/tmp/mysql.sock default-character-set=UTF8 [manager] port=3306 socket=/opt/bitnami/mysql/tmp/mysql.sock pid-file=/opt/bitnami/mysql/tmp/manager.pid default-mysqld-path=/opt/bitnami/mysql/bin/mysqld.bin
這樣就可遠程訪問。mysql
$ cd /opt/bitnami
$ sudo ./ctlscript.sh restart mysql
$ /installdir/mysql/bin/mysql -u root -p -e "grant all privileges on *.* to 'root'@'%' identified by 'your_root_password' with grant option";
若是執行完上面的命令之後還不能遠程登錄,那麼就多是防火牆的問題了,請開放3306端口。linux
sudo ufw status
詳細能夠參考:https://help.ubuntu.com/community/UFWweb