mysql二級制包安裝 for RedHat Linux Enterprise6.4

來源:互聯網
上載者:User

標籤:mysql 二進位安裝包 linux

下載mysql,並上傳至伺服器

1. 在mysql官網下載Mysql二進位安裝包

https://edelivery.oracle.com/osdc/faces/SearchSoftware?_afrLoop=2326871189822158&_afrWindowMode=0&_adf.ctrl-state=hqkzyoa95_9

2. 上傳到伺服器並且解壓

tar -xzvf mysql-advanced-5.6.26-linux-glibc2.5-x86_64.tar.gz


建立mysql帳號

useradd mysql


安裝mysql需要的包,libaio

yum install libaio*


將解壓後的mysql安裝包放到指定安裝的位置,改變屬主為mysql,並且為mysql檔案夾建立軟串連(為了方便管理)

mv mysql-advanced-5.6.26-linux-glibc2.5-x86_64 /app/

chown -R mysql:mysql /app/mysql-advanced-5.6.26-linux-glibc2.5-x86_64

ln -s ./mysql-advanced-5.6.26-linux-glibc2.5-x86_64 mysql


安裝mysql

cd /app/mysql/scripts

./mysql_install_db --user=mysql --basedir=/app/mysql --datadir=/app/mysqldata


為了方便使用,我們配置mysql使用者的設定檔 .bash_profile,添加下面內容

export MYSQL_HOME=/app/mysql

export PATH=${MYSQL_HOME}/bin:${PATH}


配置mysql

複製預設設定檔到 /etc/my.cnf 並配置

cp ./support-files/my-default.cnf /etc/my.cnf

修改裡面的內容例如

basedir=/app/mysql

datadir=/app/mysqldata

log_bin=/app/mysqllog/dbtest

innodb_buffer_pool_size = 128M

sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES 

max_binlog_cache_size=67108864

max_binlog_size=2147483648

max_binlog_stmt_cache_size=67108864

binlog_cache_size=131072

innodb_log_files_in_group=3

innodb_log_group_home_dir=/app/mysql_innodb_log


複製mysql管理指令碼到/etc/init.d 並做必要修改

cp mysql.server /etc/init.d/mysql

修改basedir和datadir

basedir=/app/mysql

datadir=/app/mysqldata


在rc{3,4,5}.d中建立mysql服務指令碼的串連,如下:

cd /etc/rc3.d  | rc4.d   | rc5.d

[[email protected] rc3.d]# ln -s ../init.d/mysql S99mysql

[[email protected] rc3.d]# ln -s ../init.d/mysql K01mysql

S99mysql 其中S表示系統啟動,99表示啟動服務次序,最後啟動服務

K01mysql 其中K表示跟隨系統關機停止服務,01表示停止服務順序,最先關閉

在另外兩個檔案夾中依次執行上面步驟


使用chkconfig命令添加服務,這樣mysql就會隨著系統啟動自動啟動了

[[email protected] rc5.d]# chkconfig --list|grep mysql

mysql          0:off1:off2:on3:on4:on5:on6:off


修改root密碼

1. 使用 mysqld_safe --skip-grant-tables啟動資料庫,跳過授權表,修改root使用者密碼

[[email protected] mysql]# ./bin/mysqld_safe --user=mysql --datadir=/app/mysqldata --basedir=/app/mysql --skip-grant-tables


mysql> update user set password=password(‘123456‘) where user=‘root‘;

mysql> flush privileges;


重啟資料庫即可


本文出自 “資料庫之路” 部落格,請務必保留此出處http://dbaway.blog.51cto.com/7099215/1703495

mysql二級制包安裝 for RedHat Linux Enterprise6.4

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.