Centos7中mysql安装

news/2024/7/7 15:02:46

一、安装YUM Repo=====================================================================
1、由于CentOS 的yum源中没有mysql,需要到mysql的官网下载yum repo配置文件。
下载命令:

wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

2、然后进行repo的安装:=====================================================================
rpm -ivh mysql57-community-release-el7-9.noarch.rpm


二、使用yum命令即可完成安装=====================================================================

1、安装命令:=====================================================================
yum install mysql-server

2、启动msyql:=====================================================================
systemctl start mysqld #启动MySQL

3、获取安装时的临时密码(在第一次登录时就是用这个密码):=====================================================================
grep 'temporary password' /var/log/mysqld.log

4、倘若没有获取临时密码,则=====================================================================
4.1、删除原来安装过的mysql残留的数据
rm -rf /var/lib/mysql

4.2.再启动mysql=====================================================================
systemctl start mysqld #启动MySQL

获取临时密码=====================================================================
grep 'temporary password' /var/log/mysqld.log


首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,=====================================================================
set global validate_password_policy=LOW;

修改密码长度=====================================================================
 set global validate_password_length=6; 
 
 修改密码长度=====================================================================
 ALTER USER 'root'@'localhost' IDENTIFIED BY '@abcd123456'; 
 
 ================================================
 2、启动msyql:
systemctl start mysqld #启动MySQL
 
 2、关闭MySQL
systemctl stop mysqld 

3、重启MySQL
systemctl restart mysqld 

4、查看MySQL运行状态
systemctl status mysqld 

5、设置开机启动
systemctl enable mysqld 

6、关闭开机启动
systemctl disable mysqld 

7、配置默认编码为utf8:
vi /etc/my.cnf #添加 [mysqld] character_set_server=utf8 init_connect='SET NAMES utf8'


http://www.niftyadmin.cn/n/3781833.html

相关文章

收集的网站

响应式设计: http://wf.uisdc.com/cn/ UI相关: http://www.uisdc.com/  优设 http://www.xueui.cn/ http://www.xueui.cn/design-theory/learn-ui-1.html  感觉UI也很有意思,慢慢学习 http://www.sketchcn.com/ http://www.cutterman.cn/zh   一款…

输入页 离开页面前弹出框

离开页面确认主要是利用了onbeforeunload事件&#xff0c;存 在着兼容问题 当该事件声明为 &#xff1a; Java代码 <body onbeforeunload "return pageBeforeunload(event);" > <script type "text/javascript" > function pageBeforeunl…

SpringBoot拦截器注入配置文件的配置参数为null的解决方案

在注册拦截器&#xff0c;即继承WebMvcConfigurerAdapter的类中&#xff0c;普通拦截器的注册方法为&#xff1a; Overridepublic void addInterceptors(InterceptorRegistry registry) {registry.addInterceptor(new LogInterceptor()).addPathPatterns("/**");supe…

csdn积分获取攻略

下载积分攻略&#xff1a;1. 个人设置里进行手机绑定CSDN账户 奖励50分 &#xff08;右上角设置-账户安全-手机绑定&#xff09;2. 完成任务送若干分积分 http://task.csdn.net/3. 上传有效资源获取积分&#xff08;上传非法&#xff0c;广告资源用户&#xff0c;将被扣除…

[ERROR] Slave I/O: error connecting to master

刚配置的MySQL主从&#xff0c;在从机上看到 点击(此处)折叠或打开 mysql> SHOW slave STATUS \\G *************************** 1. row *************************** Slave_IO_State: Connecting to master Master_Host: 172.17.210.199 Master_User: my Master_Port: 3306…

MybatisPlus 多表关联查询带分页

demo&#xff1a;https://download.csdn.net/download/caidingnu/12064636 1、目录结构 2、Controller package com.example.mybatisplustest.controller;import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metada…

keystone nova v2 python

keystone nova v2 python posted on 2017-03-08 14:30 秦瑞It行程实录 阅读(...) 评论(...) 编辑 收藏 转载于:https://www.cnblogs.com/ruiy/p/6519329.html

你和那些优秀的人差距在哪里?

前言 也许&#xff0c;有的人看到上边这个标题&#xff0c;首先会觉得这肯定是一篇广告文吧。确实&#xff0c;我们可能见过有很多号主用类似于“你的同龄人已经XXX了&#xff0c;而你还在XXX”这种风格&#xff0c;来写软文。 但是&#xff0c;我可以明确的告诉你&#xff0…