Difference between revisions of "MySQL"

From MineOS
Jump to: navigation, search
(Securing MySQL)
Line 5: Line 5:
 
The MySQL password is not set by default (blank), and can only be set when the MySQL daemon is running (upon first boot). To set the password, execute the following command as 'root':
 
The MySQL password is not set by default (blank), and can only be set when the MySQL daemon is running (upon first boot). To set the password, execute the following command as 'root':
  
  <syntaxhighlight lang="BASH">
+
  <syntaxhighlight lang="bash">
 
# mysql_secure_installation
 
# mysql_secure_installation
</syntaxhighlight >
+
</syntaxhighlight>
  
 
== Disabling MySQL ==
 
== Disabling MySQL ==
 
If you are certain you have no need for MySQL, either for websites or for your Minecraft server mods, you may remove it from the services list.
 
If you are certain you have no need for MySQL, either for websites or for your Minecraft server mods, you may remove it from the services list.
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
# vi /etc/rc.conf
 
# vi /etc/rc.conf
</nowiki>
+
</syntaxhighlight>
  
 
[[File:mysqld_rc.png|thumb|none|400px|Remove mysqld from the list]]
 
[[File:mysqld_rc.png|thumb|none|400px|Remove mysqld from the list]]
Line 22: Line 22:
 
PhpMyAdmin is available as an addon. To install, ensure you have first secured MySQL. Then, as ''root'':
 
PhpMyAdmin is available as an addon. To install, ensure you have first secured MySQL. Then, as ''root'':
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
# cd /usr/games/minecraft/addons
 
# cd /usr/games/minecraft/addons
 
# ./phpmyadmin.sh
 
# ./phpmyadmin.sh
</nowiki>
+
</syntaxhighlight>
  
 
=== mbstring module ===
 
=== mbstring module ===
 
On MineOS installations earlier than 0.4.8, php-mbstring was not included in the install. Since PhpMyAdmin operates better with this module, you can install it with another add-on. Versions 0.4.8 and beyond have this module installed by default.
 
On MineOS installations earlier than 0.4.8, php-mbstring was not included in the install. Since PhpMyAdmin operates better with this module, you can install it with another add-on. Versions 0.4.8 and beyond have this module installed by default.
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
# cd /usr/games/minecraft/addons
 
# cd /usr/games/minecraft/addons
 
# ./mbstring.sh
 
# ./mbstring.sh
</nowiki>
+
</syntaxhighlight>
  
 
=== Enabling PHP for PhpMyAdmin ===
 
=== Enabling PHP for PhpMyAdmin ===
Line 45: Line 45:
 
Edit the <tt>/etc/my.cnf</tt> file and comment out the line:
 
Edit the <tt>/etc/my.cnf</tt> file and comment out the line:
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
#skip-networking
 
#skip-networking
</nowiki>
+
</syntaxhighlight>
  
 
Edit the hosts.allow file as well to add the mysqld daemon:
 
Edit the hosts.allow file as well to add the mysqld daemon:
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
mysqld: ALL
 
mysqld: ALL
 
SSHD: ALL
 
SSHD: ALL
</nowiki>
+
</syntaxhighlight>
  
 
Have all localhost generated packets accepted by default in [[iptables]]:
 
Have all localhost generated packets accepted by default in [[iptables]]:
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
iptables -A INPUT -i lo -j ACCEPT
 
iptables -A INPUT -i lo -j ACCEPT
 
iptables-save > /etc/iptables-rules
 
iptables-save > /etc/iptables-rules
</nowiki>
+
</syntaxhighlight>
  
 
You will need to restart the mysqld daemon for these changes to take effect.
 
You will need to restart the mysqld daemon for these changes to take effect.
  
  <nowiki>
+
  <syntaxhighlight lang="bash">
 
/etc/rc.d/mysqld restart
 
/etc/rc.d/mysqld restart
</nowiki>
+
</syntaxhighlight>

Revision as of 15:06, 17 September 2011

Contents

Youtube walk-through

Securing MySQL and installing phpMyAdmin

Securing MySQL

The MySQL password is not set by default (blank), and can only be set when the MySQL daemon is running (upon first boot). To set the password, execute the following command as 'root':

# mysql_secure_installation

Disabling MySQL

If you are certain you have no need for MySQL, either for websites or for your Minecraft server mods, you may remove it from the services list.

# vi /etc/rc.conf
Remove mysqld from the list

PhpMyAdmin

PhpMyAdmin is available as an addon. To install, ensure you have first secured MySQL. Then, as root:

# cd /usr/games/minecraft/addons
# ./phpmyadmin.sh

mbstring module

On MineOS installations earlier than 0.4.8, php-mbstring was not included in the install. Since PhpMyAdmin operates better with this module, you can install it with another add-on. Versions 0.4.8 and beyond have this module installed by default.

# cd /usr/games/minecraft/addons
# ./mbstring.sh

Enabling PHP for PhpMyAdmin

PHP is only permitted to execute in /var/www/hiawatha/admin by default, follow instructions to enable PHP for /var/www/hiawatha/phpmyadmin (or you may enable PHP for all directories if you choose).

PhpMyAdmin is now accessible via https://ip-address/phpmyadmin. Note: HTTPS is required for PhpMyAdmin.

Enabling remote access/TCP-IP connectivity

Remote access/TCP-IP connectivity is disabled by default on installs <= 0.4.6--later versions can ignore this step as it has already been automated. All these actions must be done as root:

Edit the /etc/my.cnf file and comment out the line:

#skip-networking

Edit the hosts.allow file as well to add the mysqld daemon:

mysqld: ALL
SSHD: ALL

Have all localhost generated packets accepted by default in iptables:

iptables -A INPUT -i lo -j ACCEPT
iptables-save > /etc/iptables-rules

You will need to restart the mysqld daemon for these changes to take effect.

/etc/rc.d/mysqld restart