1. First check the centos7.3 database mariadb
Command: Rpm-qa|grep mariadb
If you uninstall
RPM-E (mariadb version)--nodeps
2. Go to MySQL official download RPM installation package (address)
3. Upload the installation package to the server
4. Unzip the
Command: TAR-XVF Install package name
5. Install sequentially-use command: rpm-ivh+rpm file
mysql-community-common-5.7.22-1.el7.x86_64.rpm (Install this if the error may be the own database is not uninstalled) MYSQL-COMMUNITY-LIBS-5.7.22-1.EL7.X86_64.RPM (dependent on common) MYSQL-COMMUNITY-CLIENT-5.7.22-1.EL7.X86_64.RPM (dependent on Libs) mysql-community-server-5.7.22-1.el7.x86_64.rpm (Install this if this is the wrong Only need to install Perl to perform yum install Perl ) |
6. Create MySQL group and MySQL account
Groupadd mysql-Create a group
useradd-g mysql Password
Mysqld--initialize--user=mysql
If you use MySQL account-user=mysql you can omit
7. Start MySQL
Command: Systemctl start Mysqld.service
8. The default random password
Cat/var/log/mysqld.log
9. Change the password
ALTER USER ' root ' @ ' localhost ' identified by ' new_password ';
Password can not be too simple, or error
10. Modify MySQL default encoding
Modify the/ETC/MY.CNF configuration file and add the encoding configuration under [Mysqld] as follows:
[Mysqld]
Character_set_server=utf8
init_connect= ' SET NAMES UTF8 '
Restart MySQL service in effect after modification
Turn on MySQL service |
Service mysqld Start |
Turn off MySQL service |
Service Mysqld Stop |
Restart MySQL Service |
Systemctl Restart Mysqld |
11. If the boot is not self-starting MySQL service
Systemctl Enable Mysqld
Systemctl Daemon-reload
12 Remote connections
1. Firewall, open port
To access MySQL remotely, you need to open the default port number 3306.
Using Firewall-cmd (recommended)
Firewall-cmd--permanent--zone=public--add-port=3306/tcp
Firewall-cmd--permanent--zone=public--add-port=3306/udp
Firewall-cmd–reload Firewall restart
2. Allowed to connect MySQL server appears
Mysql-u root-p
Mysql>use MySQL;
Mysql>update User Set host = '% ' where user = ' root ';
Mysql>flush privileges;
Any IP address is set to log in to the root account
Java installation
- Download the JDK and unzip it
- Setting environment variables
Java_home=java the decompression path Jre_home= $JAVA _home/jre Path= $PATH: $JAVA _home/bin: $JRE _home/bin Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar: $JRE _home/lib Export Java_home jre_home PATH CLASSPATH |
Make the configuration file effective: Source/etc/profile |
Test java-version |
Tomcat installation
- Download Tomcat and Unzip
- Open 8080 ports
Firewall-cmd--permanent--zone=public--add-port=8080/tcp
Firewall-cmd-reload
- Run into the bin directory under the Tomcat decompression directory ./startup.sh
Tomcat Self-starter
The first step:
Vim/lib/systemd/system/tomcat.service
[Unit] Description=tomcat After=network.target [Service] Type=oneshot execstart=/mnt/app/tomcat-zhidu/bin/startup.sh//self-tomcat directory execstop=/mnt/app/tomcat-zhidu/bin/shutdown.sh Execreload=/bin/kill-s HUP $MAINPID Remainafterexit=yes [Install] Wantedby=multi-user.target |
The second step is to set permissions:
chmod 754 tomcat.service
Step Three设置启动服务:
systemctl enable tomcat.service
启动一个服务
|
systemctl start firewalld.service
|
关闭一个服务
|
systemctl stop firewalld.service
|
重启一个服务
|
systemctl restart firewalld.service
|
显示一个服务的状态
|
systemctl status firewalld.service
|
在开机时启用一个服务
|
systemctl enable firewalld.service
|
在开机时禁用一个服务
|
systemctl disable firewalld.service
|
查看服务是否开机启动
|
systemctl is-enabled firewalld.service;echo $?
|
查看已启动的服务列表
|
systemctl list-unit-files|grep enabled
|
CentOS 7.3 Installation Mysql--java--tomcat