This article describes the method of installing jdk1.8.0_151 and mysql5.6.38 on centos7.2.1511. Share with you for your reference, as follows:
One: Environment
Two: Download the jdk rpm package to the local and upload it to the server (because I just started using wget to download it directly to the server, and the installation kept reporting errors, so I decided to use this stupid method)
Download link: http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.rpm
JDK is installed by default in /usr/java
Three: Configure environment variables
After installing jdk-8u151-linux-x64.rpm on my machine, the java -version operation can be performed normally without configuring environment variables, so I did not configure the JDK environment variables. But for future discomforts, here is how to configure it. The operation is as follows:
Modify the system environment variable file
vi /etc/profile
Append the following to the file:
JAVA_HOME=/usr/java/jdk1.8.0_151
JRE_HOME=/usr/java/jdk1.8.0_151/jre
PATH=PATH:JAVA_HOME/bin:
CLASSPATH=.:JAVAHOME/lib/dt.jar:JAVA_HOME/lib/tools.jar:
Make changes take effect
[ root@localhost ~]# source /etc/profile //Make changes take effect immediately[root@localhost ~]#echo $PATH //View PATH value
View system environment status
[ root@localhost ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/java/jdk1.8.0_25/bin:/usr/java/jdk1.8.0_25/jre/bin
Four: Install mysql (download and install mysql-server from the official website)
# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
# rpm -ivh mysql-community-release-el7-5.noarch.rpm
# yum install mysql-community-server
After the installation is successful, restart the mysql service.
# service mysqld restart
When mysql is installed for the first time, the root account has no password.
set password
mysql>set password for'root'@'localhost'=password('password');
Query OK,0 rows affected(0.00 sec)
mysql>
Five: configure mysql
1、 coding
The mysql configuration file is /etc/my.cnf
Finally add the encoding configuration
[ mysql]default-character-set=utf8
The character encoding here must be the same as in /usr/share/mysql/charsets/Index.xml.
2、 Remote connection settings
Assign all permissions of all tables in all databases to the root user at all IP addresses.
mysql> grant all privileges on *.* to root@'%'identified by 'password';
If it is a new user instead of root, you must first create a new user
mysql>create user 'username'@'%' identified by 'password';
At this point, you can connect remotely.
Hope this article will help you maintain CentOS server.
Recommended Posts