Install MySql in Linux

Source: Internet
Author: User
1.1 install mysql-5.1.53

Step 1: Open the terminal and enter the command mkdir-P/usr/local/eversec; create the eversec folder in the/usr/local/directory.

Step 2: Enter the command CD/root/perseus2.0/dB to enter the/root/perseus2.0/DB directory.

Step 3: Enter the command mkdir-P/usr/local/eversec/MySQL to create a MySQL folder under the/usr/local/eversec/directory; mkdir-P/usr/local/eversec/Sphinx: Create a sphinx folder in the/usr/local/eversec/directory.

Step 4: Enter the command rpm-Qa | grep MySQL to check whether MySQL has been installed before. If yes, enter the command rpm-e -- nodeps MySQL * to delete MySQL, if it is not installed before, continue to the next step. (Note: In rpm-Qa | grep MySQL, it is best to try all MySQL cases to ensure that all MySQL information can be queried)

Step 5: Enter the command tar-zxvf mysql-5.1.53.tar.gz.pdf to decompress the mysqlsource file mysql-5.1.53.tar.gz to the current directory.

Step 6: Enter the command tar -zxvfsphinx-1.10-beta.tar.gz.pdf to decompress the sphinxsource file sphinx-1.10-beta.tar.gz to the current directory.

Step 7: Enter the command CD mysql-5.1.53; enter the mysql-5.1.53 directory you just extracted.

Step 8: Create the storage/sphse directory in the MySQL source code directory, and copy all the files under the mysqlse directory in the sphse source code directory to this directory. CP-r sphserial-1.10-beta/mysqlse/* mysql-5.1.53/storage/sphserial

Step 9: Run sh build/Autorun. Sh In the MySQL source code directory

Step 10: Configure MySQL, enable the Sphinx engine, compile and install MySQL

./Configure -- prefix =/usr/local/eversec/MySQL -- With-plugins = sphsf--- with-partition

Step 2: Enter the make command to compile the original MySQL file into an executable file.

Step 2: Enter the command make install and execute the MySQL Installation File to complete the installation.

Step 2: Go to the sphinx-13th-beta directory and configure, compile, and install Sphinx:

./Configure -- prefix =/usr/local/eversec/sphfix -- With-mysql =/usr/local/eversec/MySQL

Step 2: Enter the make command to compile the original sphinx file into an executable file.

Step 2: Enter the command make install and execute the Sphinx Installation File to complete the installation.

Step 2: Enter the command CD...; to exit the current mysql-5.1.53 directory and return to the DB directory.

Step 2: Enter the command Rm-frmysql-5.1.53, sph‑17th-Beta; delete all files in the mysql-5.1.53, sph‑1.10-beta directory, and its subdirectories.

1.2 configure mysql-5.1.53

Step 1: Enter the command groupaddmysql to add the MySQL user group.

Step 2: Enter the command useradd-G MySQL to add the user MySQL to the MySQL user group.

Step 3: Enter the command/usr/local/eversec/MySQL/bin/mysql_install_db -- user = MySQL; Create a database MySQL, and the user is MySQL;

Step 4: Enter the command CP/usr/local/eversec/MySQL/share/MySQL/my-huge.cnf/etc/My. CNF; copy the my-huge.cnf file under the/usr/local/eversec/MySQL/share/MySQL/directory to the/etc/directory and rename it to: My. CNF enables MySQL to run in big data mode in the future. (Note that during actual installation, copy my. CnF in the database directory to the/etc directory because the file has been configured for security)

Step 5: Enter the command chkgmysql/etc/My. CNF; change the group ownership named my. CnF in the/etc/directory to MySQL.

Step 6: Enter the command chmod755-r/usr/local/eversec/MySQL /; change all the file permissions in the/usr/local/eversec/MySQL/directory and Its subdirectories to readable and executable for all users, and the file owner can also write.

Step 7: Enter the command chownmysql. mysql-r/usr/local/eversec/MySQL/; replace all files in the/usr/local/eversec/MySQL/directory and Its subdirectories with mysql users in the MySQL user group.

Step 8: Enter the command CP/usr/local/eversec/MySQL/share/MySQL. server/etc/init. d/mysqld; put MySql in the/usr/local/eversec/MySQL/share/MySQL/directory. copy the Server File to/etc/init. d/directory and rename it to mysqld.

Step 9: Enter the command chkconfig -- add mysqld to add the mysqld service to the system.

Step 10: Enter the command chkconfig -- level 345 mysqld on; set the mysqld service to be enabled at the level of 3, 4, and 5.

Step 2: Enter the servicemysqld start command to start the mysqld service.

Step 2: Enter the command/usr/local/eversec/MySQL/bin/mysqladmin-u Root Password '123' and set the password of the root user of MySQL to 12th.

Step 2: Enter the command ln-S/usr/local/eversec/MySQL/bin/MySQL; create a link to MySQL in the/bin/directory for the MySQL file in the/usr/local/eversec/MySQL/bin/directory.

Step 2: VI/etc/lD. So. conf and write it to the libmysqlclient. so.16 storage path

Step 2: Run ldconfig

 

Note:

1. the following commands can be used in steps 1 and 15 to create a connection.

Rm-F/usr/lib/libmysqlclient. so.16

Ln-S/usr/local/eversec/MySQL/lib/MySQL/libmysqlclient. so.16/usr/lib/libmysqlclient. so.16

2. when MySQL is started, managerof PID-file quit without updating file appears. when the error message is displayed, You need to enable/etc/SELinux/config and change SELinux = enforcing to SELinux = disabled, and then save the disk and restart the machine.

3. Check whether MySQL is successfully installed. Check the log file sfn.linux.com. Err.

Tail-F/var/lib/MySQL/sfn.linux.com. Err

090820 03:51:07 mysqld_safe starting mysqlddaemon with databases from/var/lib/MySQL

/Usr/local/libexec/mysqld: Table 'mysql. In in 'doesn' t exist

090820 3:51:07 [Error] Can't open the mysql. plugin table. Please runmysql_upgrade to create it.

090820 3:51:07 [Error] fatal error: Can't open and lock privilege tables: Table 'mysql. host' doesn' t exist

090820 03:51:07 mysqld_safe mysqld from pidfile/var/lib/MySQL/sfn.linux.com. PID ended

090820 03:51:49 mysqld_safe starting mysqlddaemon with databases from/var/lib/MySQL

/Usr/local/libexec/mysqld: Table 'mysql. In in 'doesn' t exist

090820 3:51:50 [Error] Can't open the mysql. plugin table. Please runmysql_upgrade to create it.

090820 3:51:50 [Error] fatal error: Can't open and lock privilege tables: Table 'mysql. host' doesn' t exist

090820 03:51:50 mysqld_safe mysqld from pidfile/var/lib/MySQL/sfn.linux.com. PID ended

4. The following errors often occur when compiling applications in Linux:

/Usr/bin/ld: cannot find-LXXX

This means that the corresponding library file cannot be found during the compilation process. -LXXX indicates the libxxx. So file of the Linked Library.

Note: Sometimes, because the library file is generated temporarily during the compilation process, this problem may occur if an error occurs before. The following is for the reason that the local system environment is missing ..

This error is generally caused by the following reasons:

1. the system lacks the corresponding library files;

2. The version does not match;

3. the link to the library file is incorrect;

4. Library file path settings;

For the first and second cases, you can download and install Lib. For Ubuntu, you can install it directly through apt-get:

Apt-getinstall libxxx-Dev

In general, the author will immediately check whether the system has installed the lib or whether the correct version has been selected (just used to the problem). If the problem persists, the cause of the error is either a link error or a library file path error.

Use the find command to locate the link file and check whether the link file correctly points to the desired Lib. If not, use ln-SF */libxxx. so. x */libxxx. modify the so command.

If it is a problem caused by the library file path, you can go to/etc/lD. so. conf. d directory, modify any of the conf files (user-created conf can be used to facilitate identification), write the directory where Lib is located, and enter ldconfig on the terminal to update the cache.

 

5. When MySQL is installed in centos, the system prompts that the curses/termcap library is not installed.

When the configure step is reached, the system prompts nocurses/termcap library found,

1. Download the Repository from the Internet. (./Configure-with-named-Curses-libs =/usr/lib/libncurses. so.5. It is important to specify a directory. Here is a reference .)

2. Another method is the simple Yum command. Input Yum installncurses-devel to complete the process automatically.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.