Centos6.5 install mysql

Version : Mysql 5.6.38 1. Install cmake

# tar xzvf cmake - 2.8 . 8 .tar.gz
# cd cmake-2.8.8
# ./configure
# gmake
# gmake install

2. Install curses- devel gcc
# yum -y install curses-devel gcc

3. Create users and groups
# useradd -s /sbin/nologin mysql
# groupadd mysql

4. Upload and decompress the mysql package
rz mysql-5.6.38.tar.gz
tar -ef mysql- 5.6 . 38 .tar.gz

5 , cmake compilation and installation
# cmake . -DCMAKE_INSTALL_PREFIX=/data/server/mysql \
-DMYSQL_DATADIR=/data/www/DB \
-DMYSQL_UNIX_ADDR=/data/www/DB/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-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=0 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
# make && make install 
6、添加环境变量
# vim /etc/profile
export PATH=/application/mysql/bin:/application/mysql/scripts:$PATH
Add this sentence to the end of the /etc/ profile text
sourse /etc/profile

7. Copy the configuration file and modify /etc/my.cnf
# cd /data/server/mysql/
# cp support-files/my-default.cnf /etc/my.cnf
# vim /etc/my.cnf
[mysqld]
basedir=/data/server/mysql
datadir=/data/www/DB
socket=/data/www/DB/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

[mysqld_safe]
log-error=/var/log/mysql/mysqld.log
pid-file=/data/server/mysql/mysqld.pid

[extend]
skip-name-resolve
default-storage-engine=MYISAM
default-tmp-storage-engine=MYISAM
slow_query_log=on
slow_query_log_file=/tmp/slowquery.log
long_query_time=1

8. Initialize the database
# ./scripts/mysql_install_db --user=mysql --basedir=/data/server/mysql
 --datadir=/data/www/DB

9. Set auto-start
chkconfig --level 35 mysqld on

10. Start the database
# cp support-files/mysql.server /etc/init.d/mysqld
# chmod +x /etc/init.d/mysqld
# chown -R mysql:mysql /data/server/mysql/


If there is an error in compilation, delete the CMakeCache.txt under the package

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324843977&siteId=291194637