采用源碼安裝,可以根據(jù)實(shí)際生產(chǎn)環(huán)境加入一些參數(shù),提升MySQL性能
在興安等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、成都網(wǎng)站制作 網(wǎng)站設(shè)計(jì)制作按需制作,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),高端網(wǎng)站設(shè)計(jì),營銷型網(wǎng)站,外貿(mào)網(wǎng)站建設(shè),興安網(wǎng)站建設(shè)費(fèi)用合理。
mysql官網(wǎng)https://www.mysql.com/
本文采用5.1版本盡心安裝說明,后面版本如5.5安裝方法會(huì)有些不一樣,在公司的一些生產(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ù)庫文件
安裝完后會(huì)有一些相關(guān)說明,如如何啟動(dòng)等等。
安裝安裝說明方法啟動(dòng)mysql
/usr/local/mysql/bin/mysqld_safe/usr/local/mysql/bin/mysqld_safe & &表示后臺(tái)運(yùn)行
為了更方便的啟動(dòng)mysql,可以將mysql加到全局變量中
將mysql加到全局變量中echo 'export PATH=$PATH:/usr/local/mysql/bin'>>/etc/profile
source /etc/profile
執(zhí)行mysql進(jìn)入數(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啟動(dòng)mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld 授權(quán),
將mysql服務(wù)加到開機(jī)啟動(dòng)
[root@backupserver mysql-5.1.72]# chkconfig --add mysqld
[root@backupserver mysql-5.1.72]# chkconfig mysqld on
mysql進(jìn)入數(shù)據(jù)庫
設(shè)置密碼set password for root@localhost=PASSWORD('123456');
后續(xù)采用mysql -uroot -p形式進(jìn)入mysql數(shù)據(jù)庫