Copyright (C) 2000-2012 |
GNU Info (mysql.info)Starting serverProblems Starting the MySQL Server ---------------------------------- If you are going to use tables that support transactions (BDB, InnoDB), you should first create a my.cnf file and set startup options for the table types you plan to use. Note: Table types. Generally, you start the `mysqld' server in one of three ways: * By invoking `mysql.server'. This script is used primarily at system startup and shutdown, and is described more fully in Note: Automatic start. * By invoking `safe_mysqld', which tries to determine the proper options for `mysqld' and then runs it with those options. Note: `safe_mysqld'. * On NT you should install `mysqld' as a service as follows: bin\mysqld-nt --install # Install MySQL as a service You can now start/stop `mysqld' as follows: NET START mysql NET STOP mysql Note that in this case you can't use any other options for `mysqld'! You can remove the service as follows: bin\mysqld-nt --remove # remove MySQL as a service * By invoking `mysqld' directly. When the `mysqld' daemon starts up, it changes directory to the data directory. This is where it expects to write log files and the pid (process ID) file, and where it expects to find databases. The data directory location is hardwired in when the distribution is compiled. However, if `mysqld' expects to find the data directory somewhere other than where it really is on your system, it will not work properly. If you have problems with incorrect paths, you can find out what options `mysqld' allows and what the default path settings are by invoking `mysqld' with the `--help' option. You can override the defaults by specifying the correct pathnames as command-line arguments to `mysqld'. (These options can be used with `safe_mysqld' as well.) Normally you should need to tell `mysqld' only the base directory under which MySQL is installed. You can do this with the `--basedir' option. You can also use `--help' to check the effect of changing path options (note that `--help' _must_ be the final option of the `mysqld' command). For example: shell> EXECDIR/mysqld --basedir=/usr/local --help Once you determine the path settings you want, start the server without the `--help' option. Whichever method you use to start the server, if it fails to start up correctly, check the log file to see if you can find out why. Log files are located in the data directory (typically `/usr/local/mysql/data' for a binary distribution, `/usr/local/var' for a source distribution, `\mysql\data\mysql.err' on Windows.) Look in the data directory for files with names of the form `host_name.err' and `host_name.log' where `host_name' is the name of your server host. Then check the last few lines of these files: shell> tail host_name.err shell> tail host_name.log If you find something like the following in the log file: 000729 14:50:10 bdb: Recovery function for LSN 1 27595 failed 000729 14:50:10 bdb: warning: ./test/t1.db: No such file or directory 000729 14:50:10 Can't init databases This means that you didn't start `mysqld' with `--bdb-no-recover' and Berkeley DB found something wrong with its log files when it tried to recover your databases. To be able to continue, you should move away the old Berkeley DB log file from the database directory to some other place, where you can later examine these. The log files are named `log.0000000001', where the number will increase over time. If you are running `mysqld' with BDB table support and `mysqld' core dumps at start this could be because of some problems with the BDB recover log. In this case you can try starting `mysqld' with `--bdb-no-recover'. If this helps, then you should remove all `log.*' files from the data directory and try starting `mysqld' again. If you get the following error, it means that some other program (or another `mysqld' server) is already using the TCP/IP port or socket `mysqld' is trying to use: Can't start server: Bind on TCP/IP port: Address already in use or Can't start server : Bind on unix socket... Use `ps' to make sure that you don't have another `mysqld' server running. If you can't find another server running, you can try to execute the command `telnet your-host-name tcp-ip-port-number' and press `RETURN' a couple of times. If you don't get an error message like `telnet: Unable to connect to remote host: Connection refused', something is using the TCP/IP port `mysqld' is trying to use. See Note: mysql_install_db and Note: Multiple servers. If `mysqld' is currently running, you can find out what path settings it is using by executing this command: shell> mysqladmin variables or shell> mysqladmin -h 'your-host-name' variables If `safe_mysqld' starts the server but you can't connect to it, you should make sure you have an entry in `/etc/hosts' that looks like this: 127.0.0.1 localhost This problem occurs only on systems that don't have a working thread library and for which MySQL must be configured to use MIT-pthreads. If you can't get `mysqld' to start you can try to make a trace file to find the problem. Note: Making trace files. If you are using InnoDB tables, refer to the InnoDB-specific startup options. Note: InnoDB start. If you are using BDB (Berkeley DB) tables, you should familiarize yourself with the different BDB specific startup options. Note: BDB start. automatically generated by info2www version 1.2.2.9 |