ubuntu安裝mysql 並對外暴露3306端口


安裝 sudo apt-get install mysql-client mysql-server

  1. vi /etc/mysql/mysql.conf.d/mysqld.cnf
    bind 127注掉

  2. mysql.user 授權
    update mysql.user set host = ‘%’ where username = ‘root’

  3. Allow firewall ports
    sudo ufw allow 3306/tcp
    sudo ufw allow 3306
    sudo ufw allow 8080/tcp
    sudo ufw allow 8080
    sudo service ufw restart

  4. 雲主機或docker 是否對外暴露

  5. sudo service mysql restart
    sudo netstat -tap | grep mysql


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM