CentOS installation MySQL whole process

Source: Internet
Author: User
Tags centos server file permissions

1. Download MySQL to Chinaunix

: http://download.chinaunix.net/download/0008000/7159.shtml

2. Upload to the CentOS server

This example is placed in the/home/jiangfeng3

3. Create MySQL group and user

[[email protected] ~]# Groupadd MySQL

[[email protected] ~]# useradd-g MySQL MySQL

4. Edit File Permissions

[Email protected] ~]# chmod 755 mysql-5.0.75.tar.gz

5. CentOS MySQL Compilation and installation

Extract:

[Email protected] ~]# tar zxvf mysql-5.0.75.tar.gz

Go to the MySQL installation package

[Email protected] ~]# CD mysql-5.0.75

Configuration parameters

[Email protected] ~]#/configure--prefix=/usr/local/mysql--with-extra-charsets=all--with-unix-socket-path=/usr/ Local/mysql/var/mysql.sock--with-named-curses-libs=/usr/lib/libncursesw.so.5

Pre-compilation

[[email protected] ~]# make

Installation

[[email protected] ~]# make install

6, the preparation of the CentOS MySQL installation is only the first step, we also need to make a corresponding configuration of CentOS MySQL


In general, CentOS MySQL to find the configuration file my.cnf, location in/etc directory, so we have to put the file My.cnf file in the/etc/directory.

Allow the CentOS MySQL server to be found when it starts. After we install the CentOS MySQL, the configuration file should be in the/usr/local/mysql/share/mysql directory, the configuration file has several, such as My-huge.cnf my-medium.cnf my-large.cnf MY-SMALL.CNF, different traffic sites and different server environments, of course, need to have different configuration files.

In general, the my-medium.cnf of this formulation can meet most of our needs;

Enter the/usr/local/mysql directory,

See if it's already installed??
[Email protected] ~]# cd/usr/local/mysql/
[[email protected] ~]# ls
Bin include info Lib libexec man mysql-test share Sql-bench


We copy the my-medium.cnf from the/usr/local/mysql/share/mysql directory to my.cnf to/etc directory.


[Email protected] ~]# CP/USR/LOCAL/MYSQL/SHARE/MYSQL/MY-MEDIUM.CNF/ETC/MY.CNF

After doing this, you have to create a CentOS MySQL authorization form, or the database will not start. mysql_install_db, the purpose of this command is to do this.

The commands for the CentOS MySQL installation are installed in the/usr/local/mysql/bin directory.


[Email protected] mysql]#/usr/local/mysql/bin/mysql_install_db


After running the mysql_install_db command, we look at/usr/local/mysql and we see that there is a var directory.

This directory is where all the databases are installed, such as when we created the Linuxsir database,

There is a linuxsir directory in the//usr/local/mysql/mysql/var directory. You should understand this time.

7, start the CentOS MySQL server, it may be the most relaxed, but also not happy too early, because sometimes there will be permissions errors.


CentOS MySQL server boot, should be mysql.server in the/usr/local/mysql/share/mysql directory


The Startup method is:
[[email protected] mysql]#/usr/local/mysql/share/mysql.server start


If you can't start, run/usr/local/mysql/bin/mysqld_safe--user=root to start up!!


Then enter/usr/local/mysql/share/mysql/mysql.server start to start successfully


OK, let's set the password to 123456/usr/local/mysql/bin/mysqladmin-u root password 123456


If the error is not returned, the description is correct.

Then enter/usr/local/mysql/bin/mysql-u root-p to manage the CentOS MySQL installation.

CentOS installation MySQL whole process

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.