MySQL Learning notes (platform CentOS 6)
1. Build MySQL Account
[[email protected] tools]# groupadd mysql[[email protected] tools]# useradd-s/sbin/nologin-g mysql-m MySQL
2. Configure the installation environment
[[email protected] ~]# Yum groupinstall ' development Tools '-y[[email protected] ~]# yum install gcc gcc-c++ make ncurses- Devel Bison Perl-y # Dependency Package
Installing CMake
[[email protected] tools]# tar-zxf cmake-2.8.12.tar.gz# install cmake[[email protected] tools]# CD Cmake-2.8.12[[email Protect ED] cmake-2.8.12]#/configure[[email protected] cmake-2.8.12]# gmake[[email protected] cmake-2.8.12]# gmake install[[ Email protected] cmake-2.8.12]# which cmake# configuration cmake environment variable/usr/local/bin/cmake[[email protected] cmake-2.8.12]# echo ' Export path=/usr/local/bin: $PATH ' >>/etc/profile[[email protected] cmake-2.8.12]# source/etc/profile
This cmake can also be installed through "Yum install Cmake-y", but the "CMake" installed in this way will have a warning when compiling MySQL:
cmake warning (Dev) in sql/cmakelists.txt: policy cmp0022 is not set: interface_link_libraries defines the link interface. run "cmake --help-policy cmp0022" for policy details. Use the cmake_policy command to set the policy and suppress this warning. target "Mysqld" has an INTERFACE_LINK_LIBRARIES property which differs from its link_interface_libraries properties. Interface_link_libraries:-lpthread;sql;mysys link_interface_libraries:rtthis warning is for project developers. Use -Wno-dev to suppress it.-- generating done-- build files have been written to: /root/tools/ mysql-5.5.37
3. Create the installation directory
[Email protected] ~]# mkdir-p/usr/local/mysql # installation directory [[email protected] ~]# Mkdir/db/mysql-p # Data storage directory [[email protected] ~]# chown-r mysql.mysql/usr/local/mysql[[email protected] ~]# chown-r Mysql.mys ql/db
4. Install MySQL
[[email protected] tools]# tar -zxf mysql-5.5.37.tar.gz[[email protected] Tools]# cd mysql-5.5.37[[email protected] mysql-5.5.37]# cmake > -dcmake _install_prefix=/usr/local/mysql/ \ # mysql Installation path > -dmysql_datadir=/db/mysql/ \# mysql Data Storage Path > -dmysql_unix_addr=/tmp/mysql.sock \# Specify sock location > -DMYSQL_TCP_PORT=3306 \# specify port > -DEXTRA_CHARSETS=all \# Install all character Sets > -denabled_local_infile=on > -dwith_innobase_storage_engine=1 > - Dwith_federated_storage_engine=1 > -dwith_blackhole_storage_engine=1 > -dwithout_ Example_storage_engine=1 > -dwithout_partition_storage_engine=1 > -dwith_fast_ Mutexes=1 > -dwith_zlib=bundled > -denabled_local_infile=1 > -dwith_ Readline=1 > -dwith_embedded_server=1 > -dwith_debug=0[[email protected] mysql-5.5.37]# make && make install
copy MySQL configuration file, generate data file
[email protected] mysql-5.5.37]# ll support-files/*.cnf-rw-r--r--1 root root 4667 07:30 support-files/my-huge.cn f-rw-r--r--1 root root 19759 07:30 support-files/my-innodb-heavy-4g.cnf-rw-r--r--1 root root 4641 07:30 s upport-files/my-large.cnf-rw-r--r--1 root root 4652 07:30 support-files/my-medium.cnf-rw-r--r--1 root root 2816 07:30 Support-files/my-small.cnf[[email protected] mysql-5.5.37]#/BIN/CP support-files/my-small.cnf/etc/ My.cnf
[Email protected] ~]# chown-r mysql.mysql/usr/local/mysql[[email protected] ~]#/usr/local/mysql/scripts/mysql_ install_db--basedir=/usr/local/mysql--datadir=/db/mysql--user=mysql
5. Start MySQL
[[email protected] ~]#/usr/local/mysql/bin/mysqld_safe--user=mysql &[[email protected] ~]# Netstat-ntulp | grep mysqldtcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 38437/mysqld
6. Post-installation configuration
[Email protected] ~]# echo ' export path=/usr/local/mysql/bin: $PATH ' >>/etc/profile[[email protected] ~]# source/ Etc/profile[[email protected] mysql-5.5.37]# CP Support-files/mysql.server/etc/init.d/mysqld[[email protected] ~]# chmod 700/etc/init.d/mysqld[[email protected] ~]#/etc/init.d/mysqld stop[[email protected] ~]# chkconfig--add mysqld[[ Email protected] ~]# chkconfig mysqld on
7. mysql Configuration password
[[email protected] ~]#/etc/init.d/mysqld start[[email protected] ~]# mysqladmin-uroot password ' q.1234 '
MySQL Learning note (Basic section)-Single instance mysql-5.5.x installation