Installing mysql5.7
Specific installation procedures can be found at the official website: A Quick Guide to Using the MySQL Yum Repository
- Go to the
/usr/local/src folder.
cd /usr/local/src
- Download the required RPM warehouse files on the website, then upload the files to the
/usr/local/src folder, or use mget direct access.
- Install the downloaded RPM package.
rpm -Uvh mysql80-community-release-el7-1.noarch.rpm
- Using the
yum repolist all | grep mysql view MySQL release version, the current valid version is 8.0.
yum repolist all | grep mysql
- Use
yum-config-manager the command to set the valid version of MySQL to 5.7. If you do not have the installation yum-config-manager yum-utils package installed.
#使用yum seach命令查找yum-config-manager所在的包。yum search yum-config-manager#经查询发现yum-config-manager在yum-utils包中,使用yum install进行安装。yum install yum-utils#禁用mysql 8.0yum-config-manager --disable mysql80-community#启用mysql 5.7yum-config-manager --enable mysql57-community#再次确认mysql的版本yum repolist all | grep mysql
- If you do not use
yum-config-manager a command, you can also manually edit the /etc/yum.repos.d/mysql-community.repo file to set a valid version.
vi /etc/yum.repos.d/mysql-community.repo#/etc/yum.repos.d/mysql-community.repo[mysql57-community]name=MySQL 5.7 Community Serverbaseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/#可以设置enabled为1,将当前设置设置为有效。enabled=1gpgcheck=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
- Install MySQL.
yum install mysql-community-server
- Start the MySQL service to view the MySQL status.
#启动mysql服务systemctl start mysqld.service#设置mysql服务开机启动systemctl enable mysqld.service#查看mysql服务状态systemctl status mysqld.service
- View the MySQL temporary password.
grep ‘temporary password‘ /var/log/mysqld.log
- Log in to MySQL and modify the MySQL password.
mysql -uroot -pALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘MyNewPass4!‘;
- You can use the following command to view additional MySQL-related installation packages and then use the
yum install 包名 installation for the package.
yum --disablerepo=\* --enablerepo=‘mysql*-community*‘ list available
- The MySQL configuration file is stored in and
/etc/my.cnf you can view and modify the MySQL configuration.
Installing JDK 1.8
- Use
yum search java|grep jdk the commands to view JDK-related packages.
- Install the corresponding JDK package.
yum install java-1.8.0-openjdk
- Configure the Java environment variables.
vi /etc/profile#在profile文件中添加如下内容#set java environmentJAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.171-8.b10.el7_5.x86_64JRE_HOME=$JAVA_HOME/jreCLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/libPATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/binexport JAVA_HOME JRE_HOME CLASS_PATH PATH
- Let the changes take effect.
source /etc/profile
Installing mysql5.7 and JDK 1.8 under CENTOS7