linux 安装mysql5.6 详细步骤

linux 安装mysql5.6 详细步骤

linux 安装mysql5.6版本 步骤
1.卸载老版本MySQL
find / -name mysql
rm -rf 上边查找到的路径,多个路径用空格隔开 #或者下边一条命令即可 find / -name mysql|xargs rm -rf
2.解压文件
tar -zxvf mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz
3.删除安装包,重命名解压后的文件
rm -f mysql-5.6.31-linux-glibc2.5-x86_64.tar.gz mv mysql-5.6.31-linux-glibc2.5-x86_64/ mysql
4.添加mysql用户组和mysql用户
groupadd mysql 
useradd -r -g mysql mysql
检车mysql组是否存在 groups mysql
5.安装
cd /usr/local/mysql/
mkdir ./data/mysql
chown -R mysql:mysql ./
./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
cp support-files/mysql.server /etc/init.d/mysqld
chmod 755 /etc/init.d/mysqld
cp support-files/my-default.cnf /etc/my.cnf
 ```
 ```
#修改启动脚本
vi /etc/init.d/mysqld
 ```
 ```
#修改项:
basedir=/usr/local/mysql/
datadir=/usr/local/mysql/data/mysql
 ```
 ```
#启动服务
service mysqld start
 ```
 ```
#测试连接
./bin/mysql -uroot
 ```
 ```
#加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了
export PATH=$PATH:/usr/local/mysql//bin
source /etc/profile ``` ``` #启动mysql service mysqld start #关闭mysql service mysqld stop #查看运行状态 service mysqld status

总结

##给root账户开启远程登陆
>GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION;

安装问题总结

-bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: 没有那个文件或目录
解决: yum -y install perl perl-devel

Installing MySQL system tables…./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
解决:yum -y install libaio-devel
“`

你可能感兴趣的:(mysql,linux)