Linux安装mysql、nginx、jdk

Mysql安装
rpm -qa|grep -i mysql
rpm -qa | grep -i mariadb
先卸载
rpm -e --nodeps mariadb-libs-5.5.44-2.el7.x86_64。/// yum remove mysql
完全卸载:rpm -qa|grep -i mysql
删除:rpm -ev --nodeps mysql-community-common-5.7.28-1.el7.x86_64 mysql-community-client-5.7.28-1.el7.x86_64 mysql-community-libs-5.7.28-1.el7.x86_64 mysql-community-server-5.7.28-1.el7.x86_64 mysql57-community-release-el7-8.noarch
whereis mysql
find / -name mysql
rm -rf 
rm -f /etc/my.cnf
下载yum的rpm包    wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
安装rpm包    rpm -ivh mysql57-community-release-el7-8.noarch.rpm
安装mysql服务    yum -y install mysql-server
 
systemctl enable mysqld.service
systemctl start/status/stop mysqld.service
查看已启动:systemctl list-unit-files |grep enabled
加入启动:  systemctl enable mysqld.service
免密登陆登陆之后修改root密码;
1. 在/etc/my.cnf.   新增一行
skip-grant-tables
2. 重启systemctl restart mysqld.service
3. 登陆数据库mysql -uroot -p
4. mysql> use mysql;
5. mysql> update mysql.user set authentication_string=password('xxxx') where user='root';
6. mysql> flush privileges;
7. mysql> exit;
8. 编辑/etc/my.cnf 删除哪一行,然后重启systemctl restart mysqld.service
9. 登陆mysql mysql -u root -proot
配置root外网登陆
mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
ERROR 1819 (HY000): Your password does not satisfy ...意思是你的密码强度太低
不要紧输入下面代码改变密码强度限制
mysql>set global validate_password_policy=0;
再输入下面代码把密码强度设置成最少4位
mysql>set global validate_password_length=4;
更新授权表,使更改生效
mysql>flush privileges;
这时再用navicat连接mysql数据库就成功了~
 
配置完成MySQL-5.7.22,修改第一次密码并登陆后,不论输入什么语句,都出现提示“You must reset your password using ALTER USER...”的提示错误语句,解决办法如下:(好像是一个密码过期的校验,设置为不过期就可以)
SET PASSWORD = PASSWORD('kangsichuang2017..');
ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;
FLUSH PRIVILEGES;
quit后,重新使用新密码登陆即可进行操作了。
 
如果配置好登陆报密码的错误:请记得在运行:
4. mysql> use mysql;
5. mysql> update mysql.user set authentication_string=password('xxxx') where user='root';
6. mysql> flush privileges;
7. mysql> exit;
 
Nginx yum安装:
然后我们关于nginx的rpm包
搜索一下yum库:    yum list | grep nginx
nginx-filesystem.noarch                     1.10.2-1.el6                 @epel  
collectd-nginx.x86_64                       4.10.9-4.el6                 epel   
munin-nginx.noarch                          2.0.33-1.el6                 epel   
nginx.x86_64                                1.10.2-1.el6                 epel   
nginx-all-modules.noarch                    1.10.2-1.el6                 epel   
nginx-mod-http-geoip.x86_64                 1.10.2-1.el6                 epel   
nginx-mod-http-image-filter.x86_64          1.10.2-1.el6                 epel   
nginx-mod-http-perl.x86_64                  1.10.2-1.el6                 epel   
nginx-mod-http-xslt-filter.x86_64           1.10.2-1.el6                 epel   
nginx-mod-mail.x86_64                       1.10.2-1.el6                 epel   
nginx-mod-stream.x86_64                     1.10.2-1.el6                 epel   
pcp-pmda-nginx.x86_64                       3.10.9-9.el6                 os
接下来我们选择使用yum安装nginx.x86_64 1.10.2-1.el6 epel
yum install nginx
中间会提示我们一次是否确认安装- 输入y确定
安装完毕!!接下来我们来看一下nginx的文件分布
[root@VM_239_130_centos html]# whereis nginx
nginx: /usr/sbin/nginx /etc/nginx /usr/lib64/nginx /usr/local/nginx /usr/share/nginx /usr/share/man/man3/nginx.3pm.gz /usr/share/man/man8/nginx.8.gz
其中三个文件(夹)比较重要:
路径                     作用
/usr/sbin/nginx         nginx启动路径
/etc/nginx              存放nginx的配置文件
/usr/share/nginx        默认的nginx资源库
 
查看 systemd 开机自启服务
systemctl list-unit-files |grep enabled
 
开启开机启动
systemctl enable nginx.service
 
用命令关掉nginx
pkill -9 nginx
 
后面可以用systemctl来操作nginx.service
systemctl start nginx.service
 
 
JDK安装
yum list java-1.8*
yum install java-1.8.0-openjdk.x86_64 -y
java -version

你可能感兴趣的:(Java,Linux)