CentOS 7 配置java web 环境(安装mysql数据库)
程序员文章站
2022-07-06 15:47:05
...
虽然关于服务器的配置网上有很多,但大多都有各种问题,服务器提供商不同。
没办法,所以自己记录一下
一丶配置mysql数据库
rpm -qa|grep -i mysql
查看服务器中有没有安装mysql,如果如下图所示,则没有。如果有安装,需要删除卸载后再安装,卸载方法自行百度
创建mysql路径并cd过去,如下图所示
运行以下 三条下载安装命令
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum -y install mysql-server
默认配置文件路径:
配置文件:/etc/my.cnf
日志文件:/var/log/var/log/mysqld.log
服务启动脚本:/usr/lib/systemd/system/mysqld.service
socket文件:/var/run/mysqld/mysqld.pid
执行以下命令安装vim工具
yum install -y vim*
配置 my.cnf
vim /etc/my.cnf
# 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
#
# 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
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
server_id = 1
expire_logs_days = 3
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
按i进入编辑模式,改完后按Esa,再按住Shift+两下Z保存并退出
启动mysql服务
service mysqld restart
grep "password" /var/log/mysqld.log
[email protected]: 后面既是密码
输入查找到的密码登录
alter user 'root'@'localhost' identified by '修改后密码';
CREATE USER 'koow'@'%' IDENTIFIED BY '注册用户密码';
grant all on *.* to '赋予权限的用户名'@'%' identified by '用户名密码' with grant option;
flush privileges;
exit;
以上就是mysql安装全过程,默认端口号3306
上一篇: logstash
下一篇: Haproxy群集——实战篇
推荐阅读
-
Centos7安装和配置Mysql5.7
-
CentOS7 64位下MySQL5.7安装与配置
-
CentOS7服务器环境下vsftpd安装及配置方法
-
CentOS 7中 Apache Web 服务器安装配置教程
-
mysql安装配置方法图文教程(CentOS7)
-
在centos7下安装和部署java8和mysql
-
CentOS6.5下安装JDK1.7+MYSQL5.5+TOMCAT7+nginx1.7.5环境安装文档
-
Linux学习第三篇 Centos7安装mysql5.7.16数据库
-
Centos7下编译安装配置Nginx+PHP+MySql环境
-
CentOS7环境下免编译二进制包安装MySQL5.6教程