在最后加入下面两行
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$PATH
https://blog.csdn.net/qq_21077715/article/details/85541685?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522164822106616781685320435%2522%252C%2522scm%2522%253A%252220140713.130102334…%2522%257D&request_id=164822106616781685320435&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduend~default-2-85541685.142v5pc_search_result_control_group,143v6control&utm_term=linux%E4%B8%8B%E5%AE%89%E8%A3%85tomcat&spm=1018.2226.3001.4187
通过xftp6上传到/usr/local下
解压tar -zxvf apache-tomcat-8.5.59.tar.gz
mv apache-tomcat-8.5.59/ tomcat 【重命名】
cd tomcat/
bin/startup.sh
在linux火狐中访问localhost:8080,测试成功
查询端口是否打开 firewall-cmd --permanent --query-port=8080/tcp
打开8080端口 firewall-cmd --permanent --add-port=8080/tcp
刷新 firewall-cmd --reload
https://blog.csdn.net/atongmu2017/article/details/90610444?ops_request_misc=&request_id=&biz_id=102&utm_term=linux%E5%AE%89%E8%A3%85mysql8.0&utm_medium=distribute.pc_search_result.none-task-blog-2allsobaiduweb~default-7-90610444.nonecase&spm=1018.2226.3001.4187
官网
https://dev.mysql.com/downloads/mysql/
通过xftp6上传到/usr/local下
解压tar -xvf mysql-8.0.28-linux-glibc2.12-x86_64.tar.xz
mv mysql-8.0.28-linux-glibc2.12-x86_64 mysql 【重命名】
一般习惯将用户和组命名为mysql,也可以是其他的
cd /usr/local/
groupadd mysql #增加组
useradd -r -g mysql mysql #增加用户并加入mysql组
cd mysql/ #注意:进入mysql文件下授权所有的文件
chown -R mysql:mysql ./ #把mysql文件夹所有文件所有者变为mysql组的mysql用户
passwd mysql #修改mysql用户密码
123456
mkdir data
会自动生成随机密码,先记住
bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
JhBxd#nI<7Yj
chown -R root:root ./
chown -R mysql:mysql data
cd support-files/
touch my-default.cnf
chmod 777 ./my-default.cnf
cd ../
cp support-files/my-default.cnf /etc/my.cnf
vim /etc/my.cnf
到虚拟机打开终端复制
[mysqld]
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
# These are commonly set, remove the # and set as required.
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
socket = /tmp/mysql.sock
log-error = /usr/local/mysql/data/error.log
pid-file = /usr/local/mysql/data/mysql.pid
tmpdir = /tmp
port = 3306
#lower_case_table_names = 1
# server_id = .....
# socket = .....
#lower_case_table_names = 1
max_allowed_packet=32M
default-authentication-plugin = mysql_native_password
#lower_case_file_system = on
#lower_case_table_names = 1
log_bin_trust_function_creators = ON
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
如果后期mysql运行报错,可以直接到log-error = /usr/local/mysql/data/error.log
目录下直接查看错误日志
命令:cat /usr/local/mysql/data/error.log
cd support-files/
cp mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --add mysql
chkconfig --list mysql
vim /etc/ld.so.conf
添加如下内容:
/usr/local/mysql/lib
vim /etc/profile
添加如下内容:
#MYSQL ENVIRONMENT
export PATH=$PATH:/usr/local/mysql/bin:/usr/local/mysql/lib
source /etc/profile
cd /usr/local/mysql/bin
mysql -uroot -p
这里输入之前生成的密码
alter user 'root'@'localhost' identified by '123456'; 修改密码
exit后用新密码重新连接
# mysql -uroot -p #进入数据库
> use mysql;#进入数据库
> select host, user, authentication_string, plugin from user;#查看用户信息
> GRANT ALL ON *.* TO 'root'@'%';#授权root用户可以远程登陆
> flush privileges;#立即生效
> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';#修改root用户密码
> FLUSH PRIVILEGES;#立即生效
> exit;#退出
# service mysql restart#重启mysql服务
注意:GRANT ALL ON . TO ‘root’@‘%’;报错解决
update user set host='%' where user='root'; #修改host
GRANT ALL ON *.* TO 'root'@'%';
GRANT ALL ON *.* TO 'root'@'%'; #连续输入两次 解决
先打开3306端口
查询端口是否打开 firewall-cmd --permanent --query-port=3306/tcp
打开3306端口 firewall-cmd --permanent --add-port=3306/tcp
刷新 firewall-cmd --reload
连接成功
连接不上使用下面的方法
https://www.cnblogs.com/zhangxiaoxia/p/13043508.html
参考hsp的教程
韩顺平教育–centos安装mysql5.7.docx