Debian – Install MySQL with remote root access

mysql_logoA few simple steps to install MySQL with remote root access on a Debian system.  Out of the box, as default, the root user can only log in from localhost. It’s easier to work from your laptop or workstation when your MySQL server is just a console based linux server. Either located on your home network or at a data center.

Login to your server as root, and type:
apt-get install mysql-server

Select your desired root password, and let it finish the installation.
When it’s done, type in:
mysql -u root -p

When you have logged into the MySQL Server, we will need to grant you with remote access rights. Kind of the whole purpose of this anyway.

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@’%’ IDENTIFIED BY ‘your password’ WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
mysql> quit

The MySQL server will now accept the root to be logged in from anywhere. But we need to make MySQL to accept connections from outside localhost. This is done by changing the bind in my.cnf. Type in:

vim /etc/mysql/my.cnf       (or you can use any other text editor. To install vim: apt-get install vim)

Locate the line: bind-address = 127.0.0.1
and comment it out by putting a # at the beginning of the line.

For safety I recommend binding it to your ip instead of removing the bind (or actually accept any ip).

Happy developing!

About Author

Related Posts

php8 gd

PHP8 gd Activate after installation

PHP8 GD activate after installation. GD doesn’t get activated by default. Not even a reboot after installation will activate it. So how do we do it? In…

Debian 12: linux-image-6.1.0-10amd64

Troubleshooting dependency issues in Debian 12: Resolving linux-image-6.1.0-10amd64 package dependency problems. If you installed the Debian 12 from the live image the issue is the raspi-firmware. Even…

mysql double vs float

MySQL: Double vs Float

When it comes to mysql double vs float to storing numbers with decimal places in a database, two of the most commonly used data types in MySQL…

4 Best Free Nas Software That Is Open Source

Free NAS software or operating systems that are free to use and will turn a computer into a NAS more advanced than the dedicated boxes sold. What…

Raspbian default password

Raspbian default password

Looking for the Raspbian default password? It is the most essential username and password that you will need for your raspberry. At least if you are running…

OpenMediaVault default password

OpenMediaVault default password

OpenMediaVault default password is printed in the documentation. I did not see it the first time I installed it either. So I had to do some detective…

Leave a Reply