11.9 Exercises
Question 1: | Say you installed MySQL on a Linux host, using RPM files to set up the MySQL server and clients. Can you start working with MySQL right away, or are there any further steps you must perform first? | Question 2: | After installing MySQL, the server fails to start properly. How can you find out what prevented the server from starting? | Question 3: | After installing MySQL on Linux from a tar file, the server cannot be started. Looking up the error log you find that it writes Can't find file: './mysql/host.frm' (errno: 13) to the error log before it terminates. What's the reason for this, and how could you solve the problem? | Question 4: | Under Windows, you want to install MySQL in D:\Programs\MySQL. Besides installing it there using the Setup Wizard, what additional steps must you perform so that the server runs properly? | Question 5: | Name some reasons why you would compile MySQL from source, rather than using a binary distribution provided by MySQL AB. | Question 6: | Name three limits that the operating system imposes on a MySQL server, and say how these limits affect server performance. | Question 7: | What's the maximum size for a MyISAM table?
|
Answers to Exercises | | Answer 1: | The RPM installation gives you a MySQL system that is ready to work with, if no problems occurred during the installation procedure:
The mysql login and group accounts are created The MySQL server and all client programs are installed The data directory is set up The grant tables are set up and initialized The startup script is registered The MySQL server is started
Note, however, that the initial MySQL accounts stored in the grant tables have no passwords and should be modified to make MySQL secure. | | | Answer 2: | Look in the error log, which is where the server writes error messages indicating why it couldn't start. The error log is located in the data directory and is named host_name.err, where host_name is the name of the machine on which the MySQL server is running. Another way to see error messages is to send them to the console:
On Windows, invoke the server at the command line with the --console option. On Unix, invoke mysqld directly rather than by using a startup script.
| | | Answer 3: | The error message indicates that the grant tables were not installed. The server tries to read the grant tables at startup, and if they aren't present, it reports an error for the first table file it doesn't find (host.frm). This can occur if the grant tables do not exist or if they exist but the server cannot read them. If the tables do not exist, run the mysql_install_db script to create them. If the grant tables exist, make sure that their ownership and access permissions allow the server to read them. | | | Answer 4: | You must set up an option file. The file can be either the my.ini file in the Windows directory or C:\my.cnf. It should contain the following lines:
[mysqld]
basedir=D:/Programs/MySQL
| | | Answer 5: | Reasons why you might choose to compile MySQL yourself using a source distribution include the following:
No binary distribution is available for your platform. You need to enable a feature that is not available in any of the precompiled distributions. You want to disable an unneeded feature to produce a server that uses less memory. You want to run a server built from the current development source.
| | | Answer 6: | The limits to a MySQL server imposed by the operating system include the following:
The per-process limit on number of open files. This limits the maximum size of the table cache that holds file descriptors for table files. The number of threads allowed to each process by the operating system. This limits the number of clients that can connect to a MySQL server at the same time. The backlog allowed by the operating system. This affects the maximum number of queued network connections for clients that are waiting to connect.
| | | Answer 7: | The MyISAM storage engine has an internal file size limit of about 8TB, but MyISAM tables cannot actually use files that large unless the filesystem allows it. |
|