时间:2021-07-01 10:21:17 帮助过:48人阅读
tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
ls
mkdir /application/
mv mysql-5.5.32-linux2.6-x86_64 /application/
ln -s /application/mysql-5.5.32-linux2.6-x86_64 /application/mysql
ll /application/
#创建数据目录
mkdir -p /application/mysql/data
chown -R mysql.mysql /application/mysql/data
#初始化数据库
cd /application/mysql/scripts/
./mysql_install_db --basedir=/application/mysql --datadir=/application/mysql/data --user=mysql
###出现2个ok就是初始化数据库成功
#配置mysql命令全局路径
echo ‘export PATH=/application/mysql/bin:$PATH‘ >>/etc/profile
. /etc/profile
echo $PATH
which mysql
#设置mysql配置文件
cd /application/mysql
cp support-files/my-small.cnf /etc/my.cnf
#复制启动脚本到/etc/init.d/mysql
cd /application/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 700 /etc/init.d/mysqld
sed -n ‘/^basedir=\|^datadir=/p‘ /etc/init.d/mysqld
sed -i ‘s#^datadir=#datadir=/application/mysql/data#g‘ /etc/init.d/mysqld
sed -i ‘s#^basedir=#basedir=/application/mysql#g‘ /etc/init.d/mysqld
sed -n ‘/^basedir=\|^datadir=/p‘ /etc/init.d/mysqld
/etc/init.d/mysqld start
#
echo “-------------mysql-----------------”
sleep 5
netstat -lnt |grep 3306
lsof -i :3306
########进入mysql
mysql
本文出自 “技术改变命运” 博客,请务必保留此出处http://lvnian.blog.51cto.com/7155281/1697080
一键安装二进制mysql
标签:二进制mysql