首页 > 代码库 > linux通过shell离线安装MySQL

linux通过shell离线安装MySQL

Ubuntu16.04 64位安装mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz,记录一下安装的语句,其中sed的用法不熟,以后用到,可以回顾此文。进一步学习sed用法应该查看此博客:http://www.cnblogs.com/dong008259/archive/2011/12/07/2279897.html

#!bin/bash
#program:
#       This Shell Install YunPanSever
#history:
#       2017/08/08 wff first release

tar -zxvf  mysql-5.6.37-linux-glibc2.12-x86_64.tar.gz
sudo cp mysql-5.6.37-linux-glibc2.12-x86_64 /usr/local/mysql -r
sudo cp libaio.so.1.0.1 /lib/x86_64-linux-gnu/
sudo ln -s /lib/x86_64-linux-gnu/libaio.so.1.0.1 /lib/x86_64-linux-gnu/libaio.so.1
sudo groupadd mysql
sudo useradd -r -g mysql mysql
sudo chown -R mysql:mysql /usr/local/mysql/
sudo /usr/local/mysql/scripts/mysql_install_db --user=mysql
sudo chown -R root:root /usr/local/mysql/
sudo chown -R mysql:mysql data
sudo cp support-files/mysql.server /etc/init.d/mysql
systemctl enable mysql.service
service mysql start
ps -ef|grep mysql

sudo ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
sudo ln -s /usr/local/mysql/include /usr/include/mysql

sudo ln -s /usr/local/mysql/lib/libmysqlclient.so.18.1.0  /usr/lib/x86_64-linux-gnu/libmysqlclient.so

sudo ln -s /usr/local/mysql/lib/libmysqlclient.so.18  /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18

 

linux通过shell离线安装MySQL