MySQL Source installation

Source: Internet
Author: User
Tags check character

To the website download: cmake-3.0.0.tar.gz and mysql-5.5.8.tar.gz;

Unzip the installation cmake-3.0.0.tar.gz

Tar-zxv-f cmake-3.0.0.tar.gz
CD cmake-3.0.0

./configure
Make
Make install

Unzip the installation mysql-5.5.8.tar.gz

(1), create MySQL installation directory and data storage directory

Mkdir-p/usr/local/mysql//install MySQL
Mkdir-p/usr/local/mysql/data//Storage database

(2), create MySQL users and user groups

Groupadd MySQL

Useradd-r-G MySQL MySQL

(3), decompression and installation

Tar-zxv-f mysql-5.5.8.tar.gz
CD mysql-5.5.8
CMake. -dcmake_install_prefix=/usr/local/mysql-dmysql_datadir=/usr/local/mysql/data
-ddefault_charset=utf8
-ddefault_collation=utf8_general_ci

-dextra_charsets=all
-denabled_local_infile=1
Make
Make install

Parameter description:

-dcmake_install_prefix=/usr/local/mysql//installation directory

-dinstall_datadir=/usr/local/mysql/data//Database storage directory

-ddefault_charset=utf8//using UTF8 characters

-DDEFAULT_COLLATION=UTF8_GENERAL_CI//Check character

-dextra_charsets=all//Install all extended character sets

-denabled_local_infile=1//Allow import of data from local

(4), configuration

Cd/usr/local/mysql

Chown-r Root:mysql. Set the owner owner of all files in the current directory to root, and the owning group is MySQL

Chown-r Mysql:mysql Data

CP support-files/my-medium.cnf/etc/my.cnf//Add MySQL Start-up service to system service

Cd/usr/local/mysql

scripts/mysql_install_db--user=mysql

Vi/root/.bash_profile (setting environment variables)

Source/root/.bash_profile

(5), manually start MySQL

./bin/mysqld_safe--user=mysql &//start MySQL, but cannot stop

Mysqladmin-u root-p Shutdown//Here the root user of MySQL has not configured the password, so it is null. When you need to enter a password, click the ENTER key directly

(6) MySQL has been added to the system service in the case of this way:

Service Mysql.server Start
Service Mysql.server Stop
Service Mysql.server Restart

If the above command appears: Mysql.server Unrecognized service

It is possible that MySQL has not been added to the system service, which is added in another way:

[[email protected] rhel5 mysql]# cpsupport-files/mysql.server/etc/init.d/mysql//Add MySQL startup service to system service

Note: The main is to copy Mysql.server to/etc/init.d, named MySQL. In some systems, Mysql.server is in/usr/local/mysql/share/mysql/mysql.server, and in this system, mysql.server in/usr/local/mysql/ The Support-files/mysql.server.

Then use #servicemysql start to start MySQL.

If remote connections are not yet in progress, turn off the firewall
/etc/rc.d/init.d/iptables stop

Note: If you cannot connect remotely and there is an error with MySQL errornumber 1130, add the following statement to try:

Mysql>grant all privileges on * * to ' root ' @ '% ' identified by ' ****** ' with GRANT OPTION;

Problems:

1./etc/init.d/mysql:line 256:my_print_defaults:command not found

Workaround: Check whether the/ETC/MY.CNF exists DataDir and basedir if not, increase the DataDir and Basedir directory paths.

As follows
[Mysqld]
Port = 3306
Basedir =/usr/local/mysql
DataDir =/usr/local/mysql/data
This entry is posted in Mysql. Bookmark the permalink.

To test a remote connection:

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.