1.CreateMySQLAccount Number
Useradd-m-s/sbin/nologin-u MySQL
Execution process:
[Email protected] ~]# useradd-m-s/sbin/nologin-u 49mysql
[Email protected] ~]# CAT/ETC/PASSWD | grep MySQL
Mysql:x:49:500::/home/mysql:/sbin/nologin
Parameter description:
- M do not create MySQL home directory
- S Specifies the MySQL login shell environment, Nologin indicates that the shell is not logged in
- u Specify the UID for the MySQL user
2.Check if the system existsMySQL, the uninstallation is present. In addition to installingncurses Ncurses-devel
[[email protected] ~]# rpm-q mysqldpackage mysqld is not installed[[email protected] ~]# yum install ncurses Ncurses-deve L-y
3.DownloadMySQLsoftware packages, compiling and installing
Cd/usr/src/wget Http://down1.chinaunix.net/distfiles/mysql-5.1.56.tar.gztar zxf mysql-5.1.56.tar.gzcd mysql-5.1.56 ./configure--prefix=/usr/local/mysql-5.1.56--with-unix-socket-path=/usr/local/mysql-5.1.56/tmp/mysql.sock-- With-charset=utf8--with-collation=utf8_general_ci--with-extra-charsets=gbk,gb2312--localstatedir=/usr/local/ Mysql-5.1.56/data--enable-assembler--with-mysqld-ldflags=-all-static--with-client-ldflags=-all-static-- Enable-thread-safe-client--with-mysqld-user=mysql--with-big-table--without-debug--with-pthreadmake && Make install
Execution process:
[Email protected] src]# tar zxf mysql-5.1.56.tar.gz
[Email protected] src]# CD mysql-5.1.56
[Email protected] mysql-5.1.56]#/configure--prefix=/usr/local/mysql-5.1.56--with-unix-socket-path=/usr/local/ Mysql-5.1.56/tmp/mysql.sock--with-charset=utf8--with-collation=utf8_general_ci--WITH-EXTRA-CHARSETS=GBK, Gb2312--localstatedir=/usr/local/mysql-5.1.56/data--enable-assembler--with-mysqld-ldflags=-all-static-- With-client-ldflags=-all-static--enable-thread-safe-client--with-mysqld-user=mysql-- With-big-table--without-debug--with-pthread
[[email protected] mysql-5.1.56]# make && Makeinstall
Parameter explanation:
./configure--prefix=/usr/local/mysql-5.1.56 # Specify the installation path
--with-unix-socket-path=/usr/local/mysql-5.1.56/tmp/mysql.sock \ # Specify Mysql.sock location
--with-charset=utf8 # Specify the default character set for MySQL
--with-collation=utf8_general_ci
--with-extra-charsets=gbk,gb2312 # specifying MySQL's extensible character set
--localstatedir=/usr/local/mysql-5.1.56/data # specify where MySQL database files are stored
--enable-assembler # Allow assembly mode (optimize performance)
--with-mysqld-ldflags=-all-static # server uses a static library (optimizes performance)
--with-client-ldflags=-all-static # client uses a static library (optimizes performance)
--enable-thread-safe-client # compiling mysql in a threaded fashion
--with-mysqld-user=mysql # Specify the user for MySQL to run
--with-big-tables # support for large table style
--without-debug # using non-debug mode
--with-pthread # forcing compilation with Pthread line library
After the configuration is complete, there is no error prompt, Thanke you for Choosemysql can perform a make compilation installation, and finally make install to the system
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/58/1E/wKiom1SpL4XxrGJVAADc8mtEwPo541.jpg "title=" 1.png " alt= "Wkiom1spl4xxrgjvaadc8mtewpo541.jpg"/>
4.ConfigurationMySQL
4.1 generate the main configuration file for MySQL my.cnf
[Email protected] mysql-5.1.56]# cp-f/usr/src/mysql-5.1.56/support-files/my-medium.cnf/etc/my.cnfcp:overwrite '/ Etc/my.cnf '? Y #覆盖掉原来的即可
4.2 generate MySQL startup files for easy administration
[Email protected] mysql-5.1.56]# Cp-f/usr/src/mysql-5.1.56/support-files/mysql.server/etc/init.d/mysqld[[email Protected] mysql-5.1.56]# chmod a+x/etc/init.d/mysqld[[email protected] mysql-5.1.56]# chkconfig--add mysqld[[email Protected] mysql-5.1.56]# chkconfig mysqld on
4.3 link mysql execution path
[Email protected] ~]# ln-sf/usr/local/mysql-5.1.56/bin/*/usr/local/bin/[[email protected] ~]# ln-sf/usr/local/ mysql-5.1.56/lib/mysql/*/usr/lib[[email protected] ~]# ln-sf/usr/local/mysql-5.1.56/include/mysql/*/usr/include/[ [Email protected] ~]# Ln-sf/usr/local/mysql-5.1.56//usr/local/mysql
4.5 Initializing the database
[Email protected] ~]# Cd/usr/local/mysql/bin/[[email protected] bin]#./mysql_install_db--user=mysql--basedir=/usr/ local/mysql-5.1.56/--datadir=/usr/local/mysql-5.1.56/data When two OK is present, the initialization is successful
4.6. Setting Permissions
[Email protected] bin]# chown-r root:mysql/usr/local/mysql-5.1.56/[[email protected] bin]# chown-r mysql/usr/local/ mysql-5.1.56/data/
4.7 . Start MySQL
[[Email protected] bin]# service mysqld start starting MySQL success! [Email protected] bin]# Netstat-anput | grep mysqltcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 42386/mysqld
This article is from the "Study-everyday" blog, make sure to keep this source http://studys.blog.51cto.com/9736817/1599107
MySQL single-instance installation and simple configuration (5.1.* version)