ubuntu mysql cannot connect to database server remote
1. sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf 2. Press CTRL + W and search for bind-address 3. comment out the line by adding # before 4. save the file 5. sudo service mysql restart
Here is what the above code is Doing:
1. We’re importing the mysql.connector library.
2. We’re creating a connection to the database.
3. We’re creating a cursor object.
4. We’re executing a query.
5. We’re fetching the results of the query.
6. We’re printing the results.
7. We’re closing the connection.