User Tools

Site Tools


technical:24.04_mysql_installation

24.04 Configure MySQL

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

systemctl restart apparmor

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

systemctl restart mysql
technical/24.04_mysql_installation.txt · Last modified: 2024/10/12 21:23 by wikiadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki