CentOS Mysql Installation System method _mysql

Source: Internet
Author: User
Tags localhost mysql mysql commands socket centos
CentOS Linux has been used more and more widely because of its compatibility with Rhel and the stability of enterprise-class application, and allow users to use it freely.
1] CentOS MySQL Installation decompression
[Root@localhost root]# Cd/usr/local/mysql/software
[Root@localhost software]# ls
Mysql-4.0.16.tar.gz
[Root@localhost Software] #tar zxvf mysql-4.0.16.tar.gz
2] CentOS MySQL installation and CentOS MySQL compilation: In this place it is worth noting that we are going to install the mysql-4.0.16 into our designated directory, for system and security and optimization, we recommend that you install the server class software with the source pack in the/usr/local/mysql directory. So here we are going to install mysql-4.0.16 into the/usr/local/mysql/mysql directory;
[Root@localhost Software] #cd
[Root@localhost software]# CD mysql-4.0.16
[Root@localhost mysql-4.0.16]#
./configure--prefix=/usr/local/mysql/mysql--with-mysqld-user=beinan--with-extra-charsets=all-- With-unix-socket-path=/usr/local/mysql/mysql/var/mysql.sock
[note] A little description of the options for configure:
--prefix=/usr/local/mysql/mysql mysql-4.0.16 specified to the/usr/local/mysql/mysql directory;
--with-extra-charsets=all support for multiple languages;
--with-unix-socket-path=/usr/local/mysql/mysql/var/mysql.sock This is specifies the location and filename of the online socket file after the MySQL server is started, that is, If the MySQL server is successfully started, you can see the Mysql.sock file in the/usr/local/mysql/mysql/var directory. If you can't see it, it must be CentOS MySQL installation will not start.
--with-mysqld-user=beinan This is so that the MySQL server can also make the system of ordinary users Beinan can also start CentOS MySQL server. Of course you have to ingenious. You can also change Beinan into your system already exists in the ordinary users, such as your system already exists Sir this user, then replace Beinan as Sir on the line. The advantage of starting a CentOS MySQL installation with a regular user is that the MySQL process will die out automatically. Of course, root users can also, but sometimes centos MySQL installation some process is dead, but will not automatically quit, root himself can not kill. So with ordinary users have such advantages, most will not appear CentOS MySQL process has died, but will not exit the situation;
[Root@localhost mysql-4.0.16] #make
[root@localhost mysql-4.0.16] #make Install
This is the end of the installation.
3] CentOS MySQL Compounding: Installation is only the first step, we also have to CentOS MySQL installation of the corresponding configuration;
Under normal circumstances CentOS MySQL installation to find the configuration file my.cnf, location in the/etc directory, so we have to file my.cnf files into the/etc/directory. Allow CentOS MySQL server to be found when it is started.
We centos MySQL after installation, the configuration file should be in the/usr/local/mysql/mysql/share/mysql directory, a number of preparation files, such as My-huge.cnf my-medium.cnf my-large.cnf My-small.cnf
, different traffic sites and different configuration of the server environment, of course, need to have different configuration files. Under normal circumstances, my-medium.cnf this preparation document can meet most of our needs;
Enter/usr/local/mysql This directory, see if it has been installed??
[Root@localhost mysql-4.0.16]# cd/usr/local/mysql/mysql/
[Root@localhost mysql]# ls
Bin include info Lib libexec man mysql-test share Sql-bench
We copy the my-medium.cnf from the/usr/local/mysql/mysql/share/mysql directory to my.cnf to the/etc directory.
[Root@localhost mysql]# cp/usr/local/mysql/mysql/share/mysql/my-medium.cnf/etc/my.cnf
After doing this work, you have to create a MySQL authorization form, otherwise the database will not start. mysql_install_db, the purpose of this command is to do this. The CentOS MySQL commands are installed in the/usr/local/mysql/mysql/bin directory.
[Root@localhost mysql]#/usr/local/mysql/mysql/bin/mysql_install_db
After running the mysql_install_db command, we'll look at/usr/local/mysql/mysql and we'll find that there's a directory of Var. This directory is used to install all the database locations, such as we created the Linuxsir database, in the/usr/local/mysql/mysql/var directory has a linuxsir directory. This time you should understand.
4] Start CentOS MySQL server, perhaps this is the easiest, but not too early to be happy, because there are sometimes permissions errors.
CentOS MySQL server boot, should be the/usr/local/mysql/mysql/share/mysql directory in the Mysql.server
The Startup method is:
[Root@localhost mysql]#/usr/local/mysql/mysql/share/mysql/mysql.server start
If it does not start please run/usr/local/mysql/bin/mysqld_safe--user=root will be able to start!!
Then enter/usr/local/mysql/mysql/share/mysql/mysql.server start to start successfully
Okay, let's set the password to 123456/usr/local/mysql/bin/mysqladmin-u root password 123456.
If you do not return the error description is correct.
Then enter the/usr/local/mysql/bin/mysql-u root-p can be managed CentOS MySQL installed.
Related Article

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.