mysql安装

mysql安装
版本:mysql-5.7.38-el7-x86_64.tar
cd /home/test/software/
tar -xvf mysql-5.7.38-el7-x86_64.tar
cd /usr/local
cp /home/test/software/mysql-5.7.38-el7-x86_64.tar.gz ./
tar -xzvf mysql-5.7.38-el7-x86_64.tar.gz
ln -s mysql-5.7.38-el7-x86_64 mysql

cd mysql
mkdir mysql-files
chown -R mysql:mysql mysql
bin/mysqld --initialize --user=mysql


./mysql -u root -p' ${password}'

bin/mysql_ssl_rsa_setup
bin/mysqld_safe --user=mysql &

firewall-cmd --zone=public --add-port=3306/tcp --permanent
systemctl stop firewalld
systemctl start firewalld

https://dev.mysql.com/doc/refman/5.7/en/binary-installation.html
检查libaio是否安装
whereis libaio.so.1
如果没有:http://mirror.centos.org/centos/6/os/x86_64/Packages/libaio-0.3.107-10.el6.x86_64.rpm 下载安装
创建用户、用户组
sudo groupadd mysql
sudo useradd -g mysql -d /home/mysql mysql
sudo groupadd mysql&&sudo useradd -g mysql -d /home/mysql mysql
添加sudo
cd /opt/usr/
tar zxvf /opt/usr/mysql-5.6.51-linux-glibc2.12-x86_64.tar.gz
sudo ln -s mysql-5.6.51-linux-glibc2.12-x86_64 mysql
cd mysql
sudo scripts/mysql_install_db --user=mysql
sudo bin/mysqld_safe --user=mysql &
sudo cp support-files/mysql.server /etc/init.d/mysql.server
修改root密码:
set password for root@localhost = password('mima');
创建用户:
create user 'test'@localhost identified by 'mima';
create user 'test'@'%' identified by 'mima';

set password for test@localhost = password('mima');
set password for root@localhost = password('mima');
create user 'test'@localhost identified by 'mima';
create user 'test'@'%' identified by 'mima';

posted on 2023-04-18 14:07  哼着歌啦啦啦  阅读(18)  评论(0编辑  收藏  举报