--- title: "How To: Enable Remote Access to MySQL via SSH / Command Line In Linux" slug: "how-to-enable-remote-access-to-mysql-via-ssh-command-line-in-linux" updated: 2026-07-13T03:06:44Z published: 2026-07-13T03:06:44Z canonical: "docs.serversaustralia.com.au/how-to-enable-remote-access-to-mysql-via-ssh-command-line-in-linux" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.serversaustralia.com.au/llms.txt > Use this file to discover all available pages before exploring further. # How To: Enable Remote Access to MySQL via SSH / Command Line In Linux For servers that don't run a control panel, you will need to manually enable remote access to your MySQL server via SSH. Users can also do this for servers that do utilise a Control Panel as well if desired. Once you log into your server via SSH, the steps required are as follows: 1. Firstly we need to edit the MySQL Configuration file to tell MySQL to listen on all available IP Addresses. We recommend using the **‘nano’** text editor if you’re unfamiliar with more advanced text editors. Edit the configuration file with the below command, ```shell nano /etc/mysql/my.cnf ``` ***2.*** Once you’ve loaded into the **‘nano’** text editor, press ***CTL + W*** (which will start a ‘find’ prompt), then type ***bind-address*** and press ***ENTER***. It will move the cursor to the variable **bind-address** in the configuration file. Make sure the bind-address is set to **0.0.0.0**, this means the server will listen on ALL available IP addresses. Alternately, you can specify a single public IP or private IP address here, but you cannot specify multiple IP addresses. ![](https://cdn0.mysau.com.au/helpcenter_attachments/115001326886/67b6a5aa7396a818488b2d740247c88f1967e22262169eea9a379d89ad8f2cff.png) 3. Once your configuration file has been updated, press ***CTL + O****,* then ***ENTER*** which will save the file. 4. Press ***CTL + X*** when you’re ready to exit the **‘nano’** text editor. 5. Next we will need to restart the MySQL Service for the edits to take effect. There are multiple listings below depending on your version of MySQL. ```shell service mysql restart ``` *OR* ```shell service mysqld restart ``` *OR* ```shell service mariadb restart ``` 6. Now that your MySQL Service is listening for external connections, we need to create a Remote MySQL user. This needs to be completed before MySQL will allow any external connections to your databases. To do this, open the MySQL client with the following command dependant on your version, followed by **ENTER**: ```shell mysql ``` *OR* ```shell mysql -u root -p ``` 7. To create a new user, you can use the following command and replace the example name and IP address with your own details. **(Remember to use your own credentials in the below command):** ```plaintext GRANT ALL PRIVILEGES ON databasename.tablename TO 'username'@'123.456.789.123' IDENTIFIED BY 'password'; ``` 9. Press ***ENTER*** to execute the command.***![](https://cdn0.mysau.com.au/helpcenter_attachments/115001326886/c13b52ee00443ea3f6bef56850ccd7571ddcb8f9cdb8468bf2eb993903240a63.png)*** If you want the remote user to have access to all databases and tables, replace **databasename.tablename** with wildcard values, ***.*** If you want the user to be able to create new databases and modify permissions (i.e. root user), the command needs '**WITH GRANT OPTION**' appended to the end, for example: ```plaintext GRANT ALL PRIVILEGES ON *.*TO 'username'@'123.456.789.123' IDENTIFIED BY 'password' WITH GRANT OPTION; ``` ***** is a wildcard, so if you want the user to have access to all tables in the database 'wordpress', you would use **wordpress.*** here instead. 1. Once the new user is created you will need to update their privileges with the following command and then pressing ***ENTER***: ```plaintext FLUSH PRIVILEGES; ``` Now you can exit the MySQL program by typing **exit** and pressing **ENTER.** Note: Make sure your firewall is allowing connections to port 3306 from your IP address. This will vary depending on individual firewall setups etc. Please check your relevant firewall documentation on steps to achieve this. Ensure that you only open the port to the relevant IP and do not allow access from any outside source.