So, I have been trying to set up a MySQL database to store my Python code and create a database of code. I have a droplet and got the MySQL database; I can launch the droplet console and access the MySQL database via Flags from the database Connection Details and get to mysql>, but the droplet isn’t the database. When I follow the instructions here: https://www.digitalocean.com/community/tutorials/how-to-allow-remote-access-to-mysql, this path breaks “/etc/mysql/mysql.conf.d/mysqld.cnf” after /etc there is no MySQL directory. Is there a way to access and launch the console the database is on?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Heya, @hyrschallsdamon
On top of what’s already mentioned you can also ensure that your firewall allows incoming connections on the MySQL port (default is 3306) from your remote IP address. You can do this using the
ufw
firewall if you’re using Ubuntu:With these changes you should be able to connect to your MySQL database remotely using a MySQL client like MySQL Workbench or MySQL command-line client
Regards
Hello Hyrschall,
Glad to hear you’re setting up a MySQL database to enhance your Python projects. It sounds like you’re on the right track, but let’s tackle the issue you’re facing with accessing the
mysqld.cnf
file.First you would need to access your Droplet over SSH:
Then to find the
mysqld.cnf
file, you can use thefind
command, which searches for files in a directory hierarchy.This command will search through the filesystem from the root directory (
/
) for any file namedmysqld.cnf
. Once you find the file, you can access and edit it using a text editor likenano
orvim
. For instance, if the file is located at/etc/mysql/mysql.conf.d/mysqld.cnf
, you can edit it with:Remember, after making changes to the
mysqld.cnf
file, it’s important to restart the MySQL service for the changes to take effect:Regarding remote access, as outlined in the DigitalOcean guide, make sure that the
bind-address
parameter in yourmysqld.cnf
file is set to0.0.0.0
. This setting allows MySQL to listen for connections on all network interfaces.If you’re still unable to locate the file or face any issues, the MySQL version or the operating system might have a different configuration setup. Feel free to share more details about your setup and I will be happy to help further.
I hope this helps you move forward with setting up your database. If you have any more questions or run into issues, feel free to ask!
On a side note, if you want to store your actual code in MySQL directly, this isn’t a perfect fit. It’s better to store your code in Git and GitHub and use MySQL for storing data in there rather than the code itself:
Best,
Bobby