您好,登錄后才能下訂單哦!
采用源碼安裝,可以根據(jù)實際生產(chǎn)環(huán)境加入一些參數(shù),提升mysql性能
mysql官網(wǎng)https://www.mysql.com/
本文采用5.1版本盡心安裝說明,后面版本如5.5安裝方法會有些不一樣,在公司的一些生產(chǎn)環(huán)境中也有用到
5.1版本mysql。
下載mysql源碼
解壓tar zxf mysql-5.1.72.tar.gz
cd mysql-5.1.72
配置
./configure --prefix=/usr/local/mysql \
--with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock \
--localstatedir=/usr/local/mysql/data\
--enable-assemble \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--with-pthread \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static
[root@backupserver mysql-5.1.72]# ./configure --help 查看具體的配置參數(shù)
make&&make install
這里采用開發(fā)測試模板
/bin/cp support-files/my-small.cnf /etc/my.cnf
創(chuàng)建數(shù)據(jù)庫文件
mkdir -p /usr/local/mysql/data
chown -R mysql /usr/local/mysql授權(quán)mysql用戶可以訪問mysql目錄
/usr/local/mysql/bin/mysql_install_db --user=mysql安裝mysql數(shù)據(jù)庫文件
安裝完后會有一些相關(guān)說明,如如何啟動等等。
安裝安裝說明方法啟動mysql
/usr/local/mysql/bin/mysqld_safe/usr/local/mysql/bin/mysqld_safe & &表示后臺運行
為了更方便的啟動mysql,可以將mysql加到全局變量中
將mysql加到全局變量中echo 'export PATH=$PATH:/usr/local/mysql/bin'>>/etc/profile
source /etc/profile
執(zhí)行mysql進入數(shù)據(jù)庫
[root@backupserver mysql-5.1.72]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.72 Source distribution
Copyright (c) 2000, 2013, 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.
配置/etc/init.d/mysqld啟動mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld 授權(quán),
將mysql服務(wù)加到開機啟動
[root@backupserver mysql-5.1.72]# chkconfig --add mysqld
[root@backupserver mysql-5.1.72]# chkconfig mysqld on
mysql進入數(shù)據(jù)庫
設(shè)置密碼set password for root@localhost=PASSWORD('123456');
后續(xù)采用mysql -uroot -p形式進入mysql數(shù)據(jù)庫
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。