1.新增使用者
[root@web01 tools]# useradd -s /sbin/nologin -m mysql
[root@lb01 ~]# id mysql
uid=27(mysql) gid=27(mysql) groups=27(mysql)
2.安裝相關依賴
yum install ncurses-devel libaio-devel -y
rpm -qa ncurses-devel libaio-devel
yum install cmake -y
rpm -qa cmake
cd /data
wget
tar xf mysql-5.6.34.tar.gz -c /data/
cd /data/mysql-5.6.34
4.cmake指定路徑
cmake . -dcmake_install_prefix=/data/mysql-5.6.34 \
-dmysql_datadir=/data/mysql-5.6.34/data \
-dmysql_unix_addr=/data/mysql-5.6.34/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
4.1編譯安裝
make && make install
5 建立軟連線 #防錯
ln -s /data/mysql-5.6.34/ /data/mysql
6.初始化資料庫
cp support-files/my*.cnf /etc/my.cnf
/data/mysql/scripts/mysql_install_db --basedir=/data/mysql/ --datadir=/data/mysql/data --user=mysql
7.設定許可權,加入開機自啟動
chown -r mysql.mysql /data/mysql/
8 設定mysql命令
echo 'path=/data/mysql/bin/:$path' >>/etc/profile
tail -1 /etc/profile
source /etc/profile
echo $path
mysql
9 設定密碼
mysqladmin -u root password 'oldboy123'
mysql -uroot -poldboy123
10.解決報錯
故障:error! the server quit without updating pid file
1.許可權.chown -r mysql.mysql
2.killall mysqld
2.報錯
[warning] timestamp with implicit default value is deprecated. please use --explicit_defaults_for_timestamp server option (see documentation for more details).
(中文大意:強烈建議不要使用帶有隱式預設值的timestamp。請使用explicit_defaults_for_timestamp選項)
在/etc/my.cnf下新增
explicit_defaults_
for_timestamp=
true
編譯mysql5 6 編譯安裝mysql5 6
mysqlwget tar zxvf mysql 5.6.33.tar.gz tar zxvf cmake 2.8.5.tar.gz cd cmake 2.8.5 安裝編譯工具.bootstrap prefix usr local cmake sudo gmake sudo gmake instal...
mysql5 6編譯安裝
安裝mysql5.6 安裝cmake及依賴 yum install cmake wget gcc c gcc ncurses devel git perl perl devel y centos7安裝mysql 檢查 mysql 是否已安裝 yum list installed grep mysql...
mysql5 6編譯安裝
工具 yum y install gcc yum y install gcc c yum y install make yum y install cmake 注 mysql 5.5後不再使用 configure 改用 cmake 編譯工具 wget tar zxf cmake 3.1.1.tar....