文章目录
- 🔥Linux下常用软件安装_JDK和Tomcat安装
- 🔥Linux下常用软件安装_MySQL安装
- 🔥Linux下常用软件安装_MySQL卸载
🔥Linux下常用软件安装_JDK和Tomcat安装
Jdk 安装
解压jdk安装包
tar -zxvf jdk-8u201-linux-x64.tar.gz -C/usr/local
配置环境变量
vim /etc/profile
底部加入如下配置
export JAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
生效环境变量
source /etc/profile
Tomcat 安装
解压Tomcat安装包
tar -zxvf apache-tomcat-9.0.54.tar.gz -C/usr/local
配置环境变量
export TOMCAT_HOME=/usr/local/tomcat
export PATH=$PATH:$TOMCAT_HOME/bin:$JAVA_HOME/bin
🔥Linux下常用软件安装_MySQL安装
下载YUM库
wget http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
安装YUM库
rpm -ivh mysql57-community-release-el7-10.noarch.rpm
安装数据库
yum -y install mysql-community-server
遇到报错
Failing package is: mysql-community-libs-compat-5.7.37-1.el7.x86_64
GPG Keys are configured as:
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
失败原因:
GPG对于包的源key的验证没有通过。
解决办法
在yum install 版本后面加上 --nogpgcheck
yum -y install mysql-community-server -- nogpgcheck
完成安装,重启mysql
systemctl restart mysqld
此时MySQL已经开始正常运行,不过要想进入MySQL还得先找出此时root用户的密码,通过如下命令可以在日志文件中找出密码:
grep "password" /var/log/mysqld.log
[root@hadoop8 ~]# grep "password" /var/log/mysqld.log 2018-10 13T08:33:27.994868Z 1 [Note] Atemporary password is generated for
root@localhost: yj0v.0w*ywPk
复制粘贴上边的密码进入数据库
mysql -uroot -p
输入初始密码,此时不能做任何事情,因为MySQL默认必须修改密码之后才能操作数据库修改密码命令:
ALTER USER 'root'@'localhost' IDENTIFIED BY
'123456';
Your password does not satisfy the current
policy requirements
解决报错
修改密码策略
因为当前的密码太复杂不方便后期做实验,所以使用命令修改密码策略两种方式:
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)
mysql> set global validate_password_policy=LOW;
Query OK, 0 rows affected (0.00 sec)
mysql> SET GLOBAL validate_password_length=6;
Query OK, 0 rows affected (0.00 sec)
注:执行完初始化命令后需要输入数据库root用户密码
注:密码策略分四种
1、OFF(关闭) 2、LOW(低) 3、MEDIUM(中) 4、STRONG(强)
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
开启远程连接
select User,Host,Password from user;
update user set host ="%" where user = “root”
刷新信息
mysql> flush privileges;
🔥Linux下常用软件安装_MySQL卸载
检查是否安装了MySQL组件。
[root@localhost ~]# rpm -qa | grep -i mysql
mysql57-community-release-el7-10.noarch
mysql-community-libs-5.7.36-1.el7.x86_64
mysql-community-server-5.7.36-1.el7.x86_64
mysql-community-common-5.7.36-1.el7.x86_64
mysql-community-client-5.7.36-1.el7.x86_64
mysql-community-libs-compat-5.7.36-1.el7.x86_64
卸载前关闭MySQL服务
systemctl stop mysqld
systemctl status mysqld
收集MySQL对应的文件夹信息
whereis mysql
mysql: /usr/bin/mysql /usr/lib64/mysql/usr/share/mysql/usr/share/man/man1/mysql.1.gz
卸载删除MySQL各类组件
rpm -ev --nodeps mysql57-community-release-el7-10.noarch
rpm -ev --nodeps mysql-community-libs-5.7.36-1.el7.x86_64
rpm -ev --nodeps mysql-community-server-5.7.36-1.el7.x86_64
rpm -ev --nodeps mysql-community-common-5.7.36-1.el7.x86_64
rpm -ev --nodeps mysql-community-client-5.7.36-1.el7.x86_64
rpm -ev --nodeps mysql-community-libs-compat-5.7.36-1.el7.x86_64
删除MySQL对应的文件夹
[root@DB-Server init.d]# whereis mysql
mysql:
[root@DB-Server init.d]# find / -name mysql/var/lib/mysql/var/lib/mysql/mysql/usr/lib64/mysql
[root@DB-Server init.d]# rm -rf/var/lib/mysql
[root@DB-Server init.d]# rm -rf/var/lib/mysql/mysql
[root@DB-Server init.d]# rm -rf/usr/lib64/mysql
删除mysql用户及用户组
[root@DB-Server init.d]# rpm -qa | grep -imysql