MySQL is an open source relational database software that, with its high performance, high reliability and Easy-to-use features, becomes the most popular open source database system in the server domain. At present, the use of MySQL data in the Internet is mostly a number of Web servers, because the current more popular use of Php+mysql do Dynamic Web site, so today the MySQL data is also targeted at the site. If some places do not explain very well, I hope we can have a lot of understanding and support. Thank you!!!
1, before the installation of the preparatory work
If you have previously installed MySQL in the. rpm format, you need to uninstall it here to avoid any program or port conflicts.
[Root@lcoalhost/] #rpm-e mysql-server MySQL--nodeps
You also need to create a user of the program that the MySQL service uses, or you can create it after installing MySQL.
[Root@lcoalhost/] #useradd-M-u 49-s/sbin/nologin mysql
2, compile and install MySQL
Download the MySQL source package to the specified directory, the latest version of the MySQL source package can go to http://www.mysql.com download.
[Root@lcoalhost Media] #tar zxf mysql-5.1.55.tar.gz-c/usr/src/
[Root@lcoalhost media#cd/usr/src/mysql-5.1.55
[Root@lcoalhost mysql-5.1.55]#./configure--prefix=/usr/local/mysql--with-charset=utf8--with-collation=utf8_ General_ci--with-extra-charsets=gbk,gb2312
In the above configuration commands, the meanings are as follows:
--prefix: Specifies that the MySQL database program should be installed in that directory.
--with-charset: Specifies the character set encoding that is used by default and should correspond to the proofing rules.
--with-collation: Specifies the character set code proofing rules that are used by default, and Utf8_general_ci is the universal rule for the UTF-8 character set.
--with-extra-charsets: Specifies additional supported character set encodings.
Compiling and installing
[Root@lcoalhost mysql-5.1.55] #make && make install
3, after the installation of other adjustments
1) Establish the configuration file
The Support-files directory in the MySQL source directory provides a sample configuration file for different load databases. If you are unsure about the size of your database system, you can typically select MY-MEDIUM.CNF files that meet the medium requirements of most businesses.
[Root@lcoalhost mysql-5.1.55] #cp support-files/my-medium.cnf/etc/my.cnf
2 Initialization of the database
In order to be able to use the MySQL database system normally, the initialization task should be performed in the identity of running MySQL, so as to establish user authorization Library, table and test library. The initialization script mysql_install_db is located in the bin file under the installation directory.
[Root@lcoalhost mysql-5.1.55] #cd/usr/local/mysql/bin
[Root@lcoalhost bin]#./mysql_install_db--user=mysql
[Root@lcoalhost bin] #chown-R root:mysql/usr/lcoal/mysql//set appropriate permissions for the MySQL program user
[Root@lcoalhost bin] #chown-R mysql/usr/local/mysql/var/