Difference between revisions of "MySQL"

From MineOS
Jump to: navigation, search
m (PhpMyAdmin)
 
(9 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
{{Buildfromscratch}}
 +
 
== Youtube walk-through ==
 
== Youtube walk-through ==
 
[http://www.youtube.com/watch?v=Fcr7N3f7IxY Securing MySQL and installing phpMyAdmin]
 
[http://www.youtube.com/watch?v=Fcr7N3f7IxY Securing MySQL and installing phpMyAdmin]
  
 
== Securing MySQL ==
 
== 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':
+
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:
  
<syntaxhighlight lang="bash">
+
{{executeasroot
mysql_secure_installation
+
| commands = mysql_secure_installation}}
</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.
  
<syntaxhighlight lang="bash">
+
{{executeasroot
vi /etc/rc.conf
+
| commands = vi /etc/rc.conf}}
</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]]
  
 
== PhpMyAdmin ==
 
== PhpMyAdmin ==
[[PhpMyAdmin]] is available as an addon. To install, ensure you have first secured MySQL. Then, follow the steps to download and install [[PhpMyAdmin]].
+
[[PhpMyAdmin]] is available as an addon. To install, ensure you have first secured MySQL. Then, follow the steps to download and install [[PhpMyAdmin]] from its wiki page.
  
=== Enable PHP for PhpMyAdmin ===
+
== Enabling remote access/TCP-IP connectivity ==
  
PHP is only permitted to execute in <tt>/var/www/hiawatha/admin</tt> by default, follow instructions to [[PHP#Enable_PHP_for_only_one_directory_and_its_subdirectories|enable PHP]] for <tt>/var/www/hiawatha/phpmyadmin</tt> (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''':
 
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''':
  
Line 45: Line 40:
 
Have all localhost generated packets accepted by default in [[iptables]]:
 
Have all localhost generated packets accepted by default in [[iptables]]:
  
<syntaxhighlight lang="bash">
+
{{executeasroot
iptables -A INPUT -i lo -j ACCEPT
+
| commands = iptables -A INPUT -i lo -j ACCEPT
iptables-save > /etc/iptables-rules
+
iptables-save > /etc/iptables-rules}}
</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.
  
<syntaxhighlight lang="bash">
+
{{executeasroot
/etc/rc.d/mysqld restart
+
| commands = /etc/rc.d/mysqld restart}}
</syntaxhighlight>
+
 
 +
[[Category:Maintenance]]
 +
[[Category:Securing]]
 +
[[Category:Addons]]
 +
[[Category:Connectivity]]

Latest revision as of 10:45, 2 October 2017

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:

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.

Remove mysqld from the list

PhpMyAdmin

PhpMyAdmin is available as an addon. To install, ensure you have first secured MySQL. Then, follow the steps to download and install PhpMyAdmin from its wiki page.

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:

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