Let’s consider a case where you have limited disk space available in your database server. In addition, you need a database backup quickly. However, you estimate that, the space available in the server for the backup is not enough.
Continue readingmysql
MySQL Utility – mysql_config_editor
These days most applications use some kind of database service to store data. Also, It’s important that this data is accessed securely. In that regard, this article focuses on MySQL database service and more specifically on the mysql_config_editor tool.
Continue readingApache access to Network Database on Custom port
If you have an Apache (httpd) application that needs to access a remote Database, you will have to change the SELinux policy as described bellow to allow Apache access to network databases. You have to edit the SELinux boolian settings for this.
First, check if the “httpd_can_network_connect_db” boolian set to “on”.
[root@testsrv ~]# getsebool -a | grep httpd_can_network_connect_db
httpd_can_network_connect_db --> off
By default, this is set to off. To enable network database access for Apache, execute bellow command.
setsebool -P httpd_can_network_connect_db on
Note, that “-P” is added to permanently change this setting therefore on system reboot this setting will be preserved.
If the database that the application is trying to reach is other than the default port (eg. mysql: 3306), you have to edit the SELinux Policy as described bellow.
Assume the application trying to connect to a mysql database and custom port is 1234. To get the current settings for mysql in SELinux policy,
semanage port -l | grep mysqld_port_t
To add new custom port to this mysql port group,
semanage port -a -t mysqld_port_t -p tcp 1234
Later on if you need to remove any custom port that entered in a port group, (eg: mysql:1234)
semanage port -d -t mysqld_port_t -p tcp 12345
How to increase maximum connections limit in mysql without a restart
Default maximum concurrent connections a mysql database server can handle is set as 100. If you require your mysql database server to serve higher number of concurrent connects than 100, you can set this on the fly as bellow without restarting the mysqld service. Make sure you have enough hardware resources (Generally RAM) to accommodate more connections.
To check current maximum concurrent connections,
mysql> show variables like “max_connections”;
+—————--+——-+
| Variable_name | Value |
+—————--+——-+
| max_connections | 100 |
+—————--+——-+
1 row in set (0.01 sec)