CentOS 7安装jdk-mysql-nginx
官方文档
手动部署LNMP环境(CentOS 7) (aliyun.com)
安装jdk
yum install -y java-1.8.0-openjdk
安装nginx
yum -y install nginx
启动nginx
systemctl start nginx
MySQL8.0
运行以下命令更新YUM源5.7(执行一行即可,哪行能用用哪个)
rpm -Uvh http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
sudo rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
运行以下命令安装MySQL(执行一行即可,哪行能用用哪个)
yum -y install mysql-community-server
yum install mysql-server -y
yum -y install mysql-community-server --nogpgcheck
运行以下命令查看MySQL版本号
mysql -V
启动mysql服务
systemctl start mysqld
查看mysql启动状态
systemctl status mysqld.service
设置mysql开机启动
设置开机自启
systemctl enable mysqld
重启systemctl
systemctl daemon-reload
查看mysql生成的随机密码
grep "password" /var/log/mysqld.log
更改密码
mysql -uroot -p
输入随机密码
set global validate_password_policy=LOW;
set global validate_password_length=4;
alter user 'root'@'localhost' identified by 'root';
ALTER USER 'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';
FLUSH PRIVILEGES;
use mysql;
update user set host = '%' where user ='root';
FLUSH PRIVILEGES;
exit;
删除MySQL
Linux删除MySQL - 卿屿 - 博客园 (cnblogs.com)