app开发者平台在数字化时代的重要性与发展趋势解析
560
2022-09-02
linux下安装Mysql
折腾了三四个小时,终于安装好了,还不知道用的时候会不会出幺蛾子!
1 服务器配置
1.1 内核版本
cat /proc/version# Linux version 3.10.0-229.1.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 27 03:04:26 UTC 2015
1.2 操作系统
uname -a# Linux vultr.guest 3.10.0-229.1.2.el7.x86_64 #1 SMP Fri Mar 27 03:04:26 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
1.3 Mysql版本
mysql57-community-release-el7-8
2 安装命令
2.1 配置YUM源
-安装包
wget repolist enabled | grep "mysql.-community.""
2.2 安装Mysql
yum install mysql-community-server
安装过程遇到提示,则输入Y 安装成功的提示符:
Replaced: mariadb-libs.x86_64 1:5.5.56-2.el7 Complete!
3 Mysql服务相关配置
3.1 启动mysql服务
[root@localhost ~]# systemctl start mysqld 查看MySQL的启动状态 [root@localhost ~]# systemctl status mysqld
3.2 设置开机启动
[root@localhost ~]# systemctl enable mysqld[root@localhost ~]# systemctl daemon-reload
3.3 登录mysql
3.3.1 先查看root下的账号密码
[root@localhost /]# grep 'temporary password' /var/log/mysqld.log
3.3.2 配置文件修改
1) 修改字符编码为utf8 2) 禁用密码策略
[root@localhost /]# cd /etc/[root@localhost etc]# vi my-fvalidate_password = off# For advice on how to change settings please see# 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 = 2Mdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pidvalidate_password = off #设置禁用密码策略character_set_server = utf8 #修改字符编码为utf8init_connect = 'SET NAMES utf8'
3.3.3 登录
输入命令之后会提示输入密码,即前面查看的那个密码
[root@localhost etc]# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 4Server version: 5.7.20Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the
3.4 修改登录密码
localhost是服务器的ip 引号都是英文状态下,’;’结尾,这些命令是进入mysql之后输入的
ALTER USER 'root'@'localhost' IDENTIFIED BY '12345678';
3.5 远程登录
也是在mysql下输入命令 %这里不限制远程登录的ip
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '12345678' WITH GRANT OPTION;
4 其余的坑
## 添加远程端口,注意下划线是两个哦## 远程端口是否开放firewall-cmd --permanent --query-port=3306/tcp## 添加远程端口firewall-cmd --permanent --add-port=3306/tcp## 重启防火墙
5 Summary
搭mysql的主要目的是想把比赛的数据放在数据库中,方便simple使用。虽然服务器的内存只有500M,就当是练练手吧,还有一些数据库其余的配置问题,后期再填坑吧。
6 Ref
[1] Centos7.4安装并配置Mysql5.7 [2] MYSQL添加远程用户或允许远程访问三种方法 2018-06-05 于南京 新城科技园
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~