Configure MySQL 24.04LTS: Difference between revisions
Jump to navigation
Jump to search
(Created page with "If you want to allow access to your MYSQL database from any other host rather than the LOCAL server you will have to tell MySQL to bind to the external ip address rather than the local TCP stack... 127.0.0.1 (which is the default) service mysql stop sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf Modify the line bind-address = 127.0.0.1 (change 127.0.0.1 to 192.168.3.200 the externally bound IP address) Move the default database directory off the system disk da...") |
No edit summary |
||
Line 6: | Line 6: | ||
Modify the line | Modify the line | ||
bind-address = 127.0.0.1 (change 127.0.0.1 to | bind-address = 127.0.0.1 (change 127.0.0.1 to 10.3.200.1 the externally bound IP address) | ||
Move the default database directory off the system disk | Move the default database directory off the system disk |
Latest revision as of 00:30, 13 March 2024
If you want to allow access to your MYSQL database from any other host rather than the LOCAL server you will have to tell MySQL to bind to the external ip address rather than the local TCP stack... 127.0.0.1 (which is the default)
service mysql stop sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Modify the line
bind-address = 127.0.0.1 (change 127.0.0.1 to 10.3.200.1 the externally bound IP address)
Move the default database directory off the system disk
datadir = /srv/data/mysql
Move the existing database folder to new location
mv /var/lib/mysql /srv/data/mysql
Now we need to modify apparmor to allow access to this new directory.
nano /etc/apparmor.d/local/usr.sbin.mysqld
# Site-specific additions and overrides for usr.sbin.mysqld. # For more details, please see /etc/apparmor.d/local/README. /srv/data/mysql/ r, /srv/data/mysql/** rwk, # Added to fix mem DENIED - for MySQL - check with dmesg | less capability dac_read_search, @{PROC}/@{pid}/status r, /sys/devices/system/node/ r, /sys/devices/system/node/node[0-9]*/meminfo r,
Now restart the apparmor service
service apparmor reload
Make a symlink to the new locacation (the startup script is broken startup script is broken)
ln -s /srv/data/mysql /var/lib/mysql ---- NOT NEEDED
Restart MySQL service
service mysql restart