MySql.8的安装
1) 首先删除系统默认或之前可能安装的其他版本的mysql
# for i in $(rpm -qa|grep mysql);do rpm -e $i --nodeps;done
# rm -rf /var/lib/mysql && rm -rf /etc/my.cnf
2) 安装Mysql8.0 的yum资源库
# yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
3) 安装Mysql8.0
都选y
# yum install mysql-community-server
如果提示没有这个mysql的话就运行以下命令 查看mysql官方提供的包
# yum repolist enabled | grep mysql
然后复制对应的名称运行yum 就可以了
启动MySQL服务器和MySQL的自动启动
# systemctl start mysqld
# systemctl enable mysqld
4) 使用默认密码初次登录后, 必须要重置密码
# grep 'temporary password' /var/log/mysqld.log
查看默认密码, 如下默认密码为"i(UrYe-gd0*T"
2019-11-13T01:06:07.121713Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: i(UrYe-gd0*T
使用默认密码登录 ctrl+ins复制 ctrl+shift粘贴
# mysql -uroot -p
Enter password:
修改validate_password_policy的值, mysql8.0更改了validate_password_policy相关的配置名称, 这跟Mysql5.7有点不一样了.这样会修改密码的格式
mysql> set global validate_password.policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password.length=0;
Query OK, 0 rows affected (0.00 sec)
接着再修改密码
修改密码前修改mysql密码策略
修改密码策略为0
set global validate_password.policy=0;
修改密码长度为4
set global validate_password.length=4;
修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '5201314';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
退出, 重新使用新密码登录mysql
# mysql -uroot -p5201314
查看版本
mysql> select version();
+-----------+
| version() |
+-----------+
| 8.0.18 |
+-----------+
1 row in set (0.00 sec)
查看服务端口
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.01 sec)
mysql安装成功
5)设置远程访问
进入数据库
[root@iZ4ubh1scfhy6aZ home]# mysql -uroot -p5201314
mysql> use mysql
mysql> select 'Host','User' from user;
+------+------+
| Host | User |
+------+------+
| Host | User |
| Host | User |
| Host | User |
| Host | User |
+------+------+
4 rows in set (0.00 sec)
设置都能访问
mysql> UPDATE user SET Host= '%' WHERE User= 'root' LIMIT 1;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
刷新
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
在本地测试成功
java JDK1.8安装
1)下载地址
百度网盘:https://pan.baidu.com/s/1Jrh3aBAp9Fa7tLFro31Pqw 提取码:ref7
2)使用工具winSCP上传到Linex服务器
3)使用rpm命令安装
rpm -ivh jdk-8u111-linux-x64.rpm
4)配置环境变量,JAVA_HOME
打开环境变量文件
vim /etc/profile
进入insert模式 在最后添加着这段
JAVA_HOME=/usr/java/jdk1.8.0_111
CLASSPATH=%JAVA_HOME%/lib:%JAVA_HOME%/jre/lib
PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin
export PATH CLASSPATH JAVA_HOME
退出编辑模式
1. Esc+:+wq+回车(w是write,q是quit)
2. Esc+:+x+回车(x=wq)
3. Esc+shift+zz
4. Esc+ZZ(在大写开启下)
//提示 : 输入冒号后wq :wq
最后重新载入一次
source /etc/profile
5)检查是否安装成功 java -version
[root@iZ4ubh1scfhy6aZ home]# java -version
java version "1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)