(2)解壓:
cd /server/tools
tar xf mysql-5.6.36.tar.gz
(3)安裝:
cd mysql-5.6.36
# 預約義mysql安裝目錄、mysql數據存放目錄、mysql啓動以後產生的socket文件應該存放的目錄以及socket文件名稱
# 預編譯的做用是硬編碼一些自定製的配置信息到mysql的各個程序中去
cmake . -DCMAKE_INSTALL_PREFIX=/application/mysql-5.6.36 \
-DMYSQL_DATADIR=/application/mysql-5.6.36/data \
-DMYSQL_UNIX_ADDR=/application/mysql-5.6.36/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITHOUT_EXAMPLE_STORAGE_ENGINE=1 \
-DWITH_ZLIB=bundled \
-DWITH_SSL=bundled \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_EMBEDDED_SERVER=1 \
-DENABLE_DOWNLOADS=1 \
-DWITH_DEBUG=0
make && make install
3、配置並啓動
(1)製做軟鏈接:
ln -s /application/mysql-5.6.36/ /application/mysql
# 便於後期mysql的升級
(2)拷貝配置文件到/etc:
cp support-files/my*.cnf /etc/my.cnf
(3)初始化數據庫(初始化一些元數據):
/application/mysql/scripts/mysql_install_db --basedir=/application/mysql/ --datadir=/application/mysql/data --user=mysql
(4)建立關鍵目錄並設置權限:
mkdir -p /application/mysql/tmp
chown -R mysql.mysql /application/mysql/
(5)複製啓動腳本到/etc/init.d/mysqld
cp support-files/mysql.server /etc/init.d/mysqld
(6)啓動數據庫
/etc/init.d/mysqld start
netstat -lntup|grep 330
(7)配置環境變量
echo 'PATH=/application/mysql/bin/:$PATH' >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $PATH
mysql # mysql5.6默認是沒有密碼的
select user,host,password from mysql.user;
排錯:
一、輸出
二、錯誤日誌
tail -100 /application/mysql/data/db02.err