|
Magoo's Wise Words | ||
| Posted: 6 Jun 05
P | Installing and securing MySQL Installing MySQLThe first step is to install MySQL to your web server. If your web site is hosted professionally, chances are that MySQL is already installed on the server. If it isn’t, chances are low that they will let you install it. Check with your host to see if MySQL is available and how to get access to it. If you run your own web server, or if you have followed my guide on building your own testing server, you can install MySQL fairly easily. Download the most current version of MySQL from the official web site. Scroll way down on the "Downloads" page to find the Windows compatible installers. You will need the full installation (rather than just the essentials) if you want to be able to allow PHP or Pearl to interact with your databases. Once the download finishes, extract and run the SETUP file. The setup is fairly self-explanatory and looks much like any other Windows program. At the end of the installation, say yes when it asks if you want to configure MySQL now. Choose "Detailed Configuration." On the first page, we can choose "Developer Machine," since we are only planning to run a few applications on the database. On the second page, I usually choose "Non-Transactional Database Only." This will use fewer resources. The other choices are for more complex, interactive databases that need more processing time. Since I am assuming you are only running some simple scripts (Wordpress, MoveableType, or something like that,) Non-Transactional will work just fine. Next, we get to set the number of connections allowed to the database. Since only the local computer should be accessing the database, we can choose "Manual Setting" and set it to the lowest it will allow. In the current version, 5 users is the lowest we can choose, and that is more than enough. Next we can choose weather or not to allow TCP/IP connections. The easiest thing is to enable it. You can leave it disabled if you are are using the --shared-memory option or you are using Windows NT, 2000, or XP and plan to access MySQL through a named pipe, but both are outside the scope of this tutorial. On the next page, I set my character set to Standard. You may have unique needs if you support multiple languages in your database, but standard should work just fine for most things. On the next page, you can choose weather you want MySQL to run as a service or you want to manually start it through a command line each time you want to turn it on or off. I run it as a service that I manually start and stop as I need it. On the last page, set a root password for MySQL. Make it something easy to remember yet secure. You will only need it to create users and databases. Securing MySQLThe default installation of MySQL that we just went through has some very basic and large security holes that you need to take care of if you are using this as anything more than a test database. This is especially if you are going to be using this on a public server that users will visit. By default, there are two root accounts, one for accessing MySQL from the local machine, and one for accessing it remotely. These are super user accounts and are created without a password by default. You should assign them a password before you allow visitors to your site. There is also to anonymous accounts with empty usernames and no passwords that have wide privileges. You should either delete them or assign them passwords. I explain how to do both in the next few pages. There is much more information on securing the initial MySQL accounts in the MySQL documentation. There is also information on general security issues in Chapter 5 of the MySQL documentation. | Updated:
19 Jul 06
P |