I want to tell you before I install MySQL.
Running a process in the Linux kernel must be run as a user
Today, MySQL is so no matter what the future service is the same ...
The operating environment is as follows: Very pure system nothing is installed
CentOS 6.4
mysql-5.1.72
Check results:
[[email protected] tools]# cat /etc/redhat-release centos release 6.4 (Final) [[Email protected] tools]# uname -r2.6.32-358.el6.x86_64[[email protected] tools ]# ifconfig eth0eth0 link encap:ethernet hwaddr 00:0c:29:2f:59:28 inet addr :172.16.30.11 bcast:172.16.255.255 mask:255.255.0.0 inet6 addr: fe80::20c:29ff:fe2f:5928/64 Scope:Link up broadcast running multicast mtu:1500 Metric:1 RX packets:368 errors:0 dropped:0 overruns:0 frame:0 tx packets:277 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:34526 (33.7 kib) TX bytes:37299 (36.4 kib) [[ Email protected] tools]# hostname lamp
1. Add a system user does not create a home directory does not allow users to log in just user run MySQL this process uses
[[email protected] tools]# useradd-r-s/sbin/nologin mysql[[email protected] tools]# ID mysqluid=498 (mysql) gid=498 (mysq L) groups=498 (MySQL) [[email protected] tools]# tail-1/etc/passwdmysql:x:498:498::/home/mysql:/sbin/nologin
2. Unzip the mysql-5.1.72.tar.gz software
[Email protected] tools]# pwd/root/tools[[email protected] tools]# lltotal 31024-rw-r--r--. 1 root root 133591 may 14:14 cronolog-1.6.2.tar.gz-rw-r--r--. 1 root root 7583841 Jul httpd-2.2.31.tar.gz-rw-r--r--. 1 root root 24044338 may 20:34 mysql-5.1.72.tar.gz[[email protected] tools]# tar XF mysql-5.1.72.tar.gz
3. Check the configuration
./configure \
--prefix=/application/mysql5.1.72 \
--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock \
--localstatedir=/application/mysql5.1.72/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--without-debug \
--with-pthread \
--with-extra-charsets=complex \
--with-readline \
--WITH-SSL \
--with-embedded-server \
--with-local-infile \
--with-plugins=partition,innobase \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
./configure--prefix=/application/mysql5.1.72--with-unix-socket-path=/application/mysql5.1.72/tmp/mysql.sock-- Localstatedir=/application/mysql5.1.72/data--enable-assembler--enable-thread-safe-client--with-mysqld-user= MySQL--with-big-tables--without-debug--with-pthread--with-extra-charsets=complex--with-readline--with-ssl-- With-embedded-server--with-local-infile--with-plugins=partition,innobase--with-mysqld-ldflags=-all-static-- With-client-ldflags=-all-static
Issues that you may encounter curses package is not installed
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M01/80/2C/wKioL1c6gQ7iJY8NAAAIZFWidJM802.png "title=" 02.png "alt=" Wkiol1c6gq7ijy8naaaizfwidjm802.png "/>
The solution is to install with Yum
Yum Install Ncurses-devel-y
Complete the above packaging before you proceed./configure Configuration Check it .....
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/80/2F/wKiom1c6gVHynuNHAAANaP6UkJY910.png "title=" 03.png "alt=" Wkiom1c6gvhynunhaaanap6ukjy910.png "/>
4. Compiling and installing
[[email protected] mysql-5.1.72]# echo $? Print the previous command for error 0 for success 0[[email protected] mysql-5.1.72]# make && make install//compile and install
****************************************************************************
The following initializes the configuration of MySQL data
****************************************************************************
5. Place the source program directory below
[Email protected] mysql-5.1.72]# pwd/root/tools/mysql-5.1.72[[email protected] mysql-5.1.72]# \CP support-files/ My-small.cnf/etc/my.cnf
6. Create a soft link
[Email protected] mysql-5.1.72]# ln-s/application/mysql5.1.72//application/mysql
7. Create a directory to hold the database file
[Email protected] mysql-5.1.72]# mkdir/application/mysql/data-p[[email protected] mysql-5.1.72]# ll-ld/application/ Mysql/data/drwxr-xr-x. 2 root root 4096 May 18:42/application/mysql/data/
8. Modify/application/mysql directory permissions because we want to specify user MySQL initialization
So MySQL has to have all the power of management.
[Email protected] mysql-5.1.72]# chown-r mysql:mysql/application/mysql
9. Enter initialization
/application/mysql/bin/mysql_install_db \
--basedir=/application/mysql \
--datadir=/application/mysql/data \
--user=mysql
/application/mysql/bin/mysql_install_db--basedir=/application/mysql--datadir=/application/mysql/data--user= Mysql
10. Copy the Support-files/mysql.server file to the/etc/init.d/mysqld
Start as a system service
[[email protected] support-files]# Pwd/root/tools/mysql-5.1.72/support-files[[email protected] support-files]# CP Mysql.server/etc/init.d/mysqld[[email protected] support-files]# [[email protected] support-files]# chmod a+x/etc/ Init.d/mysqld
11. For security reasons, we should return the/application/mysql authority to root.
And then set the/application/mysql/data directory to MySQL management.
[[email protected] support-files]# chown-r root:root/application/mysql[[email protected] support-files]# chown-r MySQL : mysql/application/mysql/data/
12. Start it ....
[[email protected] ~]#/etc/init.d/mysqld startstarting MySQL. success! [[email protected] ~]# lsof-i:3306command PID USER FD TYPE DEVICE size/off NODE namemysqld 19223 MySQL 10u IPv 4 103134 0t0 TCP *:mysql (LISTEN)
13. Follow-up work
Start the/etc/init.d/mysql start from the boot
Put the/application/mysql/bin in the environment variable.
[Email protected] ~]# echo "/etc/init.d/mysql start" >>/etc/rc.local [[email protected] ~]# Cd/etc/profile.d/[[em AIL protected] profile.d]# touch Mysql.sh[[email protected] profile.d]# VI mysql.sh
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/80/2C/wKioL1c6isKS6c0dAAAD5hy9okI750.png "title=" 04.png "alt=" Wkiol1c6isks6c0daaad5hy9oki750.png "/>
[[email protected] profile.d]# source mysql.sh Let the environment variable in mysql.sh take effect
14. Test
[[email protected] ~]# mysql //directly at the command line knocks mysql can enter the management ....] Welcome to the mysql monitor. commands end with ; or \ g.your mysql connection id is 2server version: 5.1.72 source distributioncopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. oracle is a registered trademark of oracle corporation and/or Itsaffiliates. other names may be trademarks of their respectiveowners . type ' help; ' or ' \h ' for help. Type ' \c ' to clear the current input statement.mysql> show databases;+--------------------+| database |+--------------------+| information_schema || mysql | | test |+-------- ------------+3 rows in set (0.00 SEC)
Congratulations, you've learned to install MySQL.
qq:771541213
MySQL 5.1.72 Installation