Secured cPanel/WHM and MySql Print

  • cPanel Security, WHM Security
  • 0

Step 1: Add the Security Lock

In Termius, open the file again (sudo nano /etc/my.cnf) and add the bind-address line directly under the [mysqld] header. It should look like this:

Ini, TOML
 
[mysqld]
bind-address=127.0.0.1
log-error=/var/lib/mysql/5-180-150-254.cprapid.com.err
performance-schema=0
innodb_buffer_pool_size=126877696
max_allowed_packet=268435456
open_files_limit=40000
innodb_file_per_table=1
plugin-load-add=auth_socket.so
unix_socket=OFF

You may need to add: 
bind-address=127.0.0.1

Step 2: Save and Restart

  1. Press Ctrl + O, then Enter to save.

  2. Press Ctrl + X to exit.

  3. Run this command to apply it: /scripts/restartsrv_mysql

Step 3: The Test

  1. Check your websites: If they load, you are 100% successful and much more secure.

  2. Check the port: Run netstat -tulnp | grep 3306. It should now show 127.0.0.1:3306.

Why this is the "Safest" way

By using 127.0.0.1, you aren't just "blocking" the door with a firewall; you are essentially removing the door's handle from the outside. Even if your firewall (CSF/iptables) is accidentally turned off or "expires," the database will still refuse to listen to anyone from the internet.

Give that a try in Termius—did the restart go through smoothly, or did you get an error message?


Was this answer helpful?

« Back