mysql-5.6.46之二進制文件安裝

下載二進制文件至/usr/local/文件夾下,以後運行腳本mysql

#!/bin/bash

groupadd mysql
useradd -r -g mysql -s /bin/false mysql

cd /usr/local/
FileName=`ls  | grep mysql | sed  '{s/.tar.gz/ /}'`
echo $FileName
tar -zxvf /usr/local/mysql* 
ln -s  $FileName    mysql

cd /usr/local/mysql
export PATH=/usr/local/mysql/bin:$PATH
echo 'export PATH=/usr/local/mysql/bin:$PATH'  >>  /root/.bash_profile


mkdir /var/lib/mysql/mysql-files -p
cd /var/lib/mysql  
chown mysql:mysql mysql-files
chmod 750 mysql-files

cd /etc
touch my.cnf
chown root:root my.cnf  
chmod 644 my.cnf

echo '[mysqld]
datadir=/var/lib/mysql/data
socket=/var/lib/mysql/mysql-files/mysql.sock
port=3306
log-error=/var/lib/mysql/data/localhost.localdomain.err
user=mysql
secure_file_priv=/var/lib/mysql/mysql-files
local_infile=OFF
pid-file=/var/lib/mysql/mysql-files/mysqld.pid

[client]
socket=/var/lib/mysql/mysql-files/mysql.sock'  > /etc/my.cnf

cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on

yum  install autoconf -y
scripts/mysql_install_db --user=mysql   --defaults-file=/etc/my.cnf

第一步:新建用戶解壓文件sql

groupadd mysql
useradd -r -g mysql -s /bin/false mysql

cd /usr/local/
FileName=`ls  | grep mysql | sed  '{s/.tar.gz/ /}'`
echo $FileName
tar -zxvf /usr/local/mysql* 
ln -s  $FileName    mysq

 

第二步:寫配置文件bash

cd /etc
touch my.cnf
chown root:root my.cnf  
chmod 644 my.cnf

echo '[mysqld]
datadir=/var/lib/mysql/data
socket=/var/lib/mysql/mysql-files/mysql.sock
port=3306
log-error=/var/lib/mysql/data/localhost.localdomain.err
user=mysql
secure_file_priv=/var/lib/mysql/mysql-files
local_infile=OFF
pid-file=/var/lib/mysql/mysql-files/mysqld.pid

[client]
socket=/var/lib/mysql/mysql-files/mysql.sock'  > /etc/my.cnf

第三步:新建存放導入導出文件的文件夾dom

mkdir /var/lib/mysql/mysql-files -p
cd /var/lib/mysql  
chown mysql:mysql mysql-files
chmod 750 mysql-files

第四步:配置自啓動socket

cd /usr/local/mysql
cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on

第四步:初始化code

yum  install autoconf -y
scripts/mysql_install_db --user=mysql   --defaults-file=/etc/my.cnf
相關文章
相關標籤/搜索