CDH 04.MySQL5.7安装配置
1、创建文件目录
mkdir -p /DATA/disk1/software/mysql/;
cd /DATA/disk1/software/mysql/;
2、下载mysql5.7包
wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar;
3、解压缩
tar -xvf mysql-5.7.30-1.el7.x86_64.rpm-bundle.tar
4、删除 mariadb-libs ( 该包对后续安装 mysql 有冲突 )
rpm -qa |grep mariadb-libs|awk '{print $1}'|xargs rpm -e --nodeps
5、安装yum相关包
yum -y install perl;
yum -y install net-tools;
yum -y install libaio;
6、安装mysql
rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm;
rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm;
rpm -ivh mysql-community-libs-compat-5.7.30-1.el7.x86_64.rpm;
rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm;
rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm;
7、配置mysql开机启动并启动
systemctl enable mysqld;
systemctl start mysqld;
systemctl status mysqld;
8、查看MySQL密码
cat /var/log/mysqld.log | grep 'password'
9、登录MySQL修改密码
mysql -uroot -p
ALTER USER 'root'@'localhost' IDENTIFIED BY 'rootROOT@1234';
flush privileges;
10、下载MySQL驱动
yum -y install mysql-connector-java.noarch
cd /usr/share/java/;
mv mysql-connector-java.jar mysql-connector-java.jar.bak;
wget https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/mysql-connector-java-5.1.47.jar
ln -s ./mysql-connector-java-5.1.47.jar ./mysql-connector-java.jar
ls -l /usr/share/java/|grep mysql-conn # 核对