centos7安装MySql(yum方式)

1.安装yum
yum install lrzsz -y
2.安装wget 用于下载mysql源安装包
yum install wget
3.下载mysql源安装包
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
4.安装mysql源
yum localinstall mysql57-community-release-el7-8.noarch.rpm
5.检查mysql源是否安装成功
yum repolist enabled | grep "mysql.*-community.*"
6.修改 vim /etc/yum.repos.d/mysql-community.repo源 改变默认安装的mysql版本。
比如要安装5.6版本,将5.7源的enabled=1改成enabled=0。然后再将5.6源的enabled=0改成enabled=1即可。
7.安装MySQL
yum install mysql-community-server
8.启动MySQL服务
systemctl start mysqld
停止MySQL服务
systemctl stop mysqld
9.开机启动msql服务
systemctl enable mysqld
systemctl daemon-reload
10.进入mysql
mysql -u root
show databases;查看数据库
退出MySQL
exit
11.设置密码
创建服务器
GRANT ALL PRIVILEGES ON *.* TO ‘root‘@‘%‘ IDENTIFIED BY ‘root‘ WITH GRANT OPTION;
进入mysql数据库
use mysql;
查看user表
select host,user,password from user;
删除除%外其他用户
delete from user where host !=‘%‘;
退出MySQL 重启服务
exit
systemctl start mysqld
systemctl stop mysqld
重新进入mysql
mysql -u root -p
密码
root
12.处理mysql中文乱码
查看mysql编码格式
show variables like ‘character%‘;
编辑配置文件
vim /etc/my.cnf
在第一行[mysqld]下插入
character-set-server=utf8
在最后插入
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
13.导入mysql数据库文件
source 路径

原文地址:https://www.cnblogs.com/wangmeng960111/p/10990057.html

时间: 2024-08-30 09:11:39

centos7安装MySql(yum方式)的相关文章

CentOS7安装Mysql并配置远程访问

(su root登录到root账户) 下载repo源 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 安装rpm包 rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装mysql yum install mysql-server 执行后开始下载和解压操作,过程中会遇到多次Y/N询问,输入y然后回车确认 安装完成后再次查看mysql rpm -qa|grep

Centos7 安装 mysql

首先CentOS7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安装mysql的步骤. #列出所有被安装的rpm package rpm -qa | grep mariadb #卸载rpm -e mariadb-libs-5.5.44-2.el7.centos.x86_64 错误:依赖检测失败:libmysqlclient.so.18()(64bit) 被 (已安

Centos7 安装Mysql 然而mysql-server 安装失败的问题

安装mysql和mysql-devel都成功,但是安装mysql-server失败,如下: [[email protected] ~]# yum install mysql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.sina.cn * extras: mirrors.sina.cn * updates: mirrors.sina.cn No pac

CentOS7 安装mysql(YUM方式)

1.下载mysql源安装包 shell> wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 2.安装mysql源 shell> yum localinstall mysql57-community-release-el7-8.noarch.rpm 3.检查mysql源是否安装成功 shell> yum repolist enabled | grep "mysql.*-communit

centos7下使用yum方式安装PHP7

一.安装准备 使用以下命令将yum仓库包升级更换成PHP7的rpm包 rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm 二.开始安装 1.先使用yum命令安装基本PHP组件,以后要用到啥再安装啥 yum -y install php70w.x86_64 ph

Centos7安装mysql缺乏yum源怎么安装

找到mysql5.6的centos的repo源,终于解决mysql的安装问题: 1.确保centos安装了wget,没有的话安装wget 1 yum install wget 2.下载mysql的repo源 1 wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 3.安装mysql-community-release-el7-5.noarch.rpm包 1 rpm -ivh mysql-community-rel

CentOS7 安装 MySQL 5.7(yum) - IT书 - itbook.com

原创来源:IT书 - itbook.com 安装并启动 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm yum localinstall mysql57-community-release-el7-8.noarch.rpm -y yum repolist enabled | grep "mysql.*-community.*" yum install mysql-community-ser

Centos7安装mysql

CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql的repo源. 1. 下载mysql的repo源 $ wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm 2. 安装mysql-community-release-el7-5.noarch.rpm包 $ sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装这个

CentOS7安装MySQL并开启远程访问

1.安装MySQL CentOS7中默认安装了MySQL系列的数据库,需要先卸载掉. 查看当前安装的mariadb包: [[email protected] desktop]# rpm -qa | grep mariadb 将它们统统强制性卸载掉: [[email protected] 桌面]# rpm -e --nodeps mariadb-libs-5.5.35-3.el7.x86_64 在官网下载RPM安装包,http://dev.mysql.com/downloads/mysql/,下载