您好,登錄后才能下訂單哦!
操作系統
more /etc/centos-release
CentOS release 6.8 (Final)
mysql5.6.44版本獲取
https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
1:依賴包安裝
yum list cmake
yum install cmake -y
yum install gcc-c++ -y
yum install readline-devel pcre-devel ncurses-devel bison-devel -y
2:創建目錄安裝,用戶,獲取安裝包
mkdir /home/setup
cd /home/setup
wget https://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.44.tar.gz
useradd mysql -s /sbin/nologin -M
tar -zxvf mysql-5.6.44.tar.gz
3:編譯安裝
cd /home/setup/mysql-5.6.44
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6 \
-DMYSQL_DATADIR=/data/3306/data \
-DMYSQL_UNIX_ADDR=/data/3306/tmp/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_EGINE=1 \
-DWITH_FAST_MUTEXES=1 \
-DWITH_ZLIB=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_READLINE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DWITH_DEBUG=0
#DCMAKE_INSTALL_PREFIX MySQL安裝的根目錄
#DMYSQL_DATADIR 數據存放的目錄
#DMYSQL_UNIX_ADDR MySQL的sock文件目錄 mysql服務器用于監聽的套接字,必需是絕對路徑
make && make install && cd ..
4:安裝數據庫
cd /application/mysql/scripts/
./mysql_install_db --basedir=/application/mysql/ --datadir=/data/3306/data --user=mysql
中途有2個ok表示安裝成功
mkdir /data/3306/tmp/
chown -R mysql.mysql /data/3306/tmp/
cp /application/mysql/bin/* /usr/local/sbin/
cp /application/mysql/support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
[mysqld] 添加:
datadir=/data/3306/data
default-storage-engine=InnoDB
lower_case_table_names=1
port=3306
5:啟動數據庫
cd /application/mysql/bin
./mysqld_safe --defaults-file=/data/3306/data/my.cnf --user=mysql &
登錄數據庫
mysql -uroot -S /data/3306/tmp/mysql.sock
6:設置開機自啟動
cp support-files/mysql.server /etc/init.d/mysql
相關命令:
service mysql start
停止mysql服務
service mysql stop
重啟mysql服務
service mysql restart
添加到開機啟動項
chkconfig --add mysql
偶爾會遇到如下報錯
FATAL ERROR: please install the following Perl modules before executing ./scripts/mysql_install_db:
解決方法
yum-y install autoconf
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。