본문 바로가기
IT 와 Social 이야기/Python

[Tech With Tim] How to Host a MySQL Server on Linux

by manga0713 2020. 5. 11.

 

 

 

 

 

*** Python에서 MySql과 Sql 사용하기 5

- Hosting a MySQL Server on a Linux


*** Download Putty: https://www.putty.org

*** Process and Linux Commands

Once you have logged into the linux server run the following:



sudo apt-get install mysql-server sudo mysql_secure_installation utility sudo ufw enable # allows remote access sudo ufw allow mysql sudo systemctl start mysql sudo systemctl enable mysql cd to /etc/mysql/mysql.conf.d/mysqld.cnf change bind to 0.0.0.0 sudo systemctl restart mysql # restart mysql Now obtain your PUBLIC IPV4 Address from the machine you want to connect with. mysql -u root -p create database Test Get ip address GRANT ALL ON fooDatabase.* TO fooUser@'PUBLIC IPV4 ADDRESS' IDENTIFIED BY 'some password' Then you can connect to the linux servers ip address as the host attribute for the MySQL connection. Use the username you set in the last command and the password.