MySQL 5 source installation complete process record under CentOS

Source: Internet
Author: User
Tags openssl library readline

Reference: http://blog.csdn.net/mycwq/article/details/24488691

    1. Installation of Cmake,mysql 5.5 to be compiled with CMake

In the newly installed CentOS 5.7 system, the first installation of Nginx (with Nginx must rely on: gzip module needs zlib library; Rewrite module requires Pcre library; The SSL feature requires the OpenSSL library), resulting in the installation cmake process. Bootstrap this step can not be passed, the reason is unknown. After the VM snapshot recovery to not install Nginx before the smooth installation of CMake.

Installation steps:

    1. Official website Download http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
    2. Tar zxvf cmake-2.8.10.2.tar.gz
    3. CD cmake-2.8.10.2
    4. ./bootstrap
    5. Make
    6. Make install
    7. Cmake–h Verifying installation Results

    1. Start installing MySQL

Official website Download source installation package: https://cdn.mysql.com//Downloads/MySQL-5.5/mysql-5.5.57.tar.gz

Install MySQL

    1. [Email protected] ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz
    2. [Email protected] ~]# tar xvf mysql-5.5.37.tar.gz
    3. [Email protected] ~]# CD mysql-5.5.37
    4. [Email protected] mysql-5.5.37]# CMake.

It's probably going to be a mistake, not a jump.

  1. CMake Error at cmake/readline.cmake:83 (MESSAGE):
  2. Curses Library not found. Pleaseinstall appropriate package,
  3. Remove CMakeCache.txt and rerun CMake. On Debian/ubuntu, package name Islibncurses5-dev, on Redhat and derivates it is ncurses-devel.
  4. Call Stack (most recent call first):
  5. cmake/readline.cmake:127 (find_curses)
  6. cmake/readline.cmake:217 (Mysql_use_bundled_libedit)
  7. cmakelists.txt:355 (mysql_check_readline
  8. --Configuring incomplete, Errors occurred!
  9. See also "/root/my/mysql-5.5.37/cmakefiles/cmakeoutput.log".
  10. See also "/root/my/mysql-5.5.37/cmakefiles/cmakeerror.log".

Stating that the CentOS system is not ncurses-devel

    1. [Email protected] ~]# wget http://invisible-island.net/datafiles/release/ncurses.tar.gz
    2. [Email protected] ~]# CD ncurses-5.9
    3. [Email protected] Ncurses-5.9]#./configure
    4. [[email protected] ncurses-5.9]# make
    5. [[email protected] ncurses-5.9]# make install

Then delete the CMakeCache.txt file that you just compiled, or you cannot proceed to the next step

    1. [Email protected] mysql-5.5.37]# rm-f CMakeCache.txt

Continue compiling MySQL

    1. [Email protected] ~]# CMake.
    2. [[email protected] ~]# make
    3. [[email protected] ~]# make install

This way, MySQL will install successfully to/usr/local/mysql by default

Create a MySQL user group

    1. [[email protected] ~]# Groupadd MySQL
    2. [[email protected] ~]# useradd–r–g MySQL MySQL
    3. [Email protected] ~]# chown–r mysql.mysql/usr/local/mysql


Start MySQL

    1. [Email protected] ~]#/usr/local/mysql/bin/mysqld_safe--user=mysql

There may be an error, no skipping:

    1. FATAL Error:could not Find./bin/my_print_defaults
    2. If you compiled from source, you need Torun "make install" to
    3. Copy the software into the correct locationready for operation.
    4. If you is using a binary release, you Musteither is at the top
    5. Level of the extracted archive, or pass the--BASEDIR option
    6. Pointing to the location.

Workaround:

    1. [Email protected] ~]#/usr/local/mysql/scripts/mysql_install_db--user=mysql--basedir=/usr/local/mysql--datadir=/ Usr/local/mysql/data

Start MySQL again

    1. [Email protected] ~]#/usr/local/mysql/bin/mysqld_safe--user=mysql

Register MySQL service, boot automatically

1. Set up MySQL configuration file to/etc directory

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

2. Set up MySQL Boot

    1. [Email protected] ~]# Cp/usr/local/mysql/support-files/mysql.server/etc/init.d/mysql
    2. [Email protected] ~]# chmod +x/etc/init.d/mysql
    3. [[email protected] ~]#/sbin/chkconfig--add MySQL

3. Start the MySQL service

    1. [[Email protected] ~]# service MySQL start

Test if MySQL is installed successfully

  1. [Email protected] ~]#/usr/local/mysql/bin/mysql-u root-p
  2. Enter Password:
  3. Welcome to the MySQL Monitor. Commands End With; or \g.
  4. Your MySQL Connection ID is 1
  5. Server version:5.5.37 Source Distribution
  6. Copyright (c) and/or, Oracle, Itsaffiliates. All rights reserved.
  7. Oracle is a registered trademark of oraclecorporation and/or its
  8. Affiliates. Other names trademarksof their respective
  9. Owners.
  10. Type ' help ', ' or ' \h ' for help. Type ' \c ' toclear the current input statement.
  11. mysql> show databases;
  12. +--------------------+
  13. | Database |
  14. +--------------------+
  15. | Information_schema |
  16. | MySQL |
  17. | Performance_schema |
  18. | Test |
  19. +--------------------+
  20. 4 rows in Set (0.03 sec)

Reference:

http://blog.csdn.net/mycwq/article/details/24488691

Last error when starting MySQL, the serverquit without updating PID file error occurred

Resolution process: http://blog.sina.com.cn/s/blog_637e04c9010117ri.html

[Email protected] ~]# Cd/usr/local/mysql

[Email protected] mysql]# chown-r mysql.mysql.
[Email protected] mysql]# Su-mysql
[Email protected] ~]$ Cd/usr/local/mysql
[Email protected] mysql]$ scripts/mysql_install_db
Installing MySQL system tables ...
Ok
Filling Help Tables ...
Ok

To start mysqld at boot time youhave to copy
Support-files/mysql.server to the right place for your system

REMEMBER to SET A passwordfor the MySQL root USER!
To does so, start the server, then issue the following commands:

./bin/mysqladmin-u root password ' new-password '
./bin/mysqladmin-u root-h localhost.localdomain password ' new-password '

Alternatively you can run:
./bin/mysql_secure_installation

Which would also give you the optionof removing the test
Databases and anonymous user created by default. This is
Strongly recommended for production servers.

See the Manual for Moreinstructions.

You can start the MySQL daemonwith:
Cd. ;./bin/mysqld_safe &

You can test the MySQL daemon withmysql-test-run.pl
CD./mysql-test; Perl mysql-test-run.pl

Problems with The./bin/mysqlbug script!

[Email protected] mysql]$/usr/local/mysql/bin/mysqld_safe--user=mysql &
[1] 11767
[Email protected] mysql]$ 120502 07:01:17 mysqld_safe Logging to '/usr/local/mysql/data/localhost.localdomain.err '.
120502 07:01:17 Mysqld_safe starting mysqld daemon with databases From/usr/local/mysql/data
[Email protected] mysql]$/etc/rc.d/init.d/mysql status
MySQL running (11830) [OK]
[[email protected] mysql]$/etc/rc.d/init.d/mysql start
Startingmysql [OK]

Finally here $/etc/rc.d/init.d/mysqlstart may need to be cut back to the root user to start successfully

Additional configuration

If the non-local environment cannot log on to MySQL, make the following changes

Firewall open 3306 port in 1.Centos:

-A input-p tcp-m tcp--dport 3306-j ACCEPT

2.Mysql allows the root user to log on any IP:

Update user sethost= "%" where user= "root";

3. mysql Cancel table name is case-sensitive

Modify/ETC/MY.CNF: Under the [Mysqld] node, add a line: Lower_case_table_names=1

4. Import the. sql file using the Mysql-workbench tool

MySQL 5 source installation complete process record under CentOS

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.