Centos7.1部署mysql-5.6.34(筆記)

這裏安裝我用的的是mysql二進制包,主要減少編譯安裝的時間,當然快的還有yum的安裝方式。

mysql個版本下載地址:http://mirrors.sohu.com/mysql/

 

1、解決相關依賴問題,否則初始化數據庫會出現錯誤

yum install -y perl-Module-Install.noarch libaio*


2、解壓軟件包到/usr/local/src

tar xf mysql-5.6.34-linux-glibc2.5-x86_64.tar.gz -C /usr/local/src/

 

3、設置mysql

cd /usr/local/src/mysql-5.6.34-linux-glibc2.5-x86
ln -sv /usr/local/src/mysql-5.6.34-linux-glibc2.5-x86_64 /usr/local/mysql
cd /usr/local/mysql/
#創建用戶給予權限
useradd  mysql  -s /sbin/nologin
chown  -R mysql.mysql  ./* –R
#創建mysql的數據目錄
mkdir /data/mysql && chown  mysql.mysql /data/mysql –R
#初始化mysql
/usr/local/mysql/scripts/mysql_install_db  --user=mysql --datadir=/data/mysql --basedir=/usr/local/mysql/
#拷貝mysql的啓動文件以及配置文件
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
cp /usr/local/mysql/my.cnf  /etc/my.cnf
#設置mysql的環境變量
ln -sv /usr/local/mysql/bin/mysql /usr/bin/
#最後啓動mysql即可
/etc/init.d/mysql restart
#訪問mysql
[root@localhost ~]# /usr/local/mysql/bin/mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.6.34 MySQL Community Server (GPL)
Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章