OS environment: The RedHat Linux 2007 Virtual OS installed in Virtual PC 9.0 is a bare operating system and has not been installed with any other software.
Mysql version: 5.1.7
========================================================== ========================================================== ==========
As a cainiao, I have never used Linux before, but I do not know that there are so many ways to install a software in Linux. It has been a long time. There are two main methods to install software in Linux:
1) install the source code package: you can download the source code package of the program from the Internet, which is usually a compressed file, * .tar.gz file. In this case, you need to compile and install the package After decompressing the package. You usually need to execute a series of commands such as./configure, make, and make install.
2) RPM package installation: the RPM package is a compiled binary installation package. Based on your own hardware environment and operating system, download the corresponding RPM package from the Internet and execute rpm-ivh *. you can install the rpm command.
The RPM package is used for installation. The downloaded packages include:
MySQL-client-5.1.7-0.i386.rpm
MySQL-server-5.1.7-0.i386.rpm
MySQL-shared-5.1.7-0.i386.rpm
Run the following command to enter the directory of the package as the root user:
# Rpm-qa | grep mysql check whether mysql has been installed in the system. If yes, write and uninstall it.
# Rpm-ivh *. you can install the above three rpm packages separately in the order of shared, client, and server.
Run the above # rpm-ivh *. when you run the rpm command, the error "rpmdb: page 649: illegal page type or format" may be displayed. The cause is that rpmdb is damaged. You must first run the following command to fix the problem:
# Rm-f/var/lib/rpm/_ db .*
# Rpm-vv-rebuilddb
After the rpmdb is repaired, install it again.
After the installation is complete, run the following command to add the server configuration file. You can adjust the file as needed:
# Cp/usr/share/mysql/my-large.cnf/etc/my. cnf
After the rpm package is installed, mysql is automatically installed as a system service. Therefore, run the following command to start and stop mysql:
1) start mysql:/etc/init. d/mysql start or service mysql start
2) stop mysql:/etc/init. d/mysql stop or service mysql stop
After the installation is complete, the related directories or files are as follows:
1)/usr/share/mysql/: Start the script mysql. server and the sample configuration file,
Such as my-huge.cnf, my-large.cnf, my-medium.cnf, etc.
2)/usr/bin/mysql *: mysql-related tools
3)/usr/sbin/mysqld: server program
4)/var/lib/mysql/: data directory. By default, mysql uses the Error Log File, binary log file, and process File
Written in the/var/lib/mysql directory, such as localhost. err, localhost. pid,
Localhost-bin.001, etc. To change these situations, you can modify the/etc/my. cnf file.
For example, to write a log file in the/var/log directory, you can add the following two lines to the my. cnf file:
[Mysqld_safe]
Err-log =/var/log/mysqld. log
5)/usr/bin/mysql_install_db: This program can be used to initialize the mysql database, that is, to create the/var/log/mysql directory,
And create mysql database (mysql authorization table and other information) and test database (empty database ),
If you accidentally delete the/var/log/mysql directory, you can use this program to initialize it.