在Fedora 20 上安装Mysql并初始化root密码

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介: [root@localhost ~]# yum -y install community-mysql-server #安装数据库 已加载插件:langpacks, refresh-packagekit google-chrome 3/3 正在解决依赖关系 There are unfinished transactions remaining.
[root@localhost ~]# yum -y install community-mysql-server #安装数据库

已加载插件:langpacks, refresh-packagekit
google-chrome 3/3
正在解决依赖关系
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> 正在检查事务
---> 软件包 community-mysql-server.x86_64.0.5.5.35-1.fc20 将被 安装
--> 正在处理依赖关系 community-mysql-common(x86-64) = 5.5.35-1.fc20,它被软件包 community-mysql-server-5.5.35-1.fc20.x86_64 需要
--> 正在处理依赖关系 mysql(x86-64),它被软件包 community-mysql-server-5.5.35-1.fc20.x86_64 需要
--> 正在检查事务
---> 软件包 community-mysql.x86_64.0.5.5.35-1.fc20 将被 安装
---> 软件包 community-mysql-common.x86_64.0.5.5.35-1.fc20 将被 安装
--> 解决依赖关系完成

依赖关系解决

================================================================================
Package 架构 版本 源 大小
================================================================================
正在安装:
community-mysql-server x86_64 5.5.35-1.fc20 updates 8.8 M
为依赖而安装:
community-mysql x86_64 5.5.35-1.fc20 updates 4.9 M
community-mysql-common x86_64 5.5.35-1.fc20 updates 208 k

事务概要
================================================================================
安装 1 软件包 (+2 依赖软件包)

总下载量:14 M
安装大小:78 M
Downloading packages:
(1/3): community-mysql-5.5.35-1.fc20.x86_64.rpm | 4.9 MB 00:04 
(2/3): community-mysql-common-5.5.35-1.fc20.x86_64.rpm | 208 kB 00:00 
(3/3): community-mysql-server-5.5.35-1.fc20.x86_64.rpm | 8.8 MB 00:03 
--------------------------------------------------------------------------------
总计 1.4 MB/s | 14 MB 00:09 
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : community-mysql-common-5.5.35-1.fc20.x86_64 1/3 
正在安装 : community-mysql-5.5.35-1.fc20.x86_64 2/3 
正在安装 : community-mysql-server-5.5.35-1.fc20.x86_64 3/3 
验证中 : community-mysql-5.5.35-1.fc20.x86_64 1/3 
验证中 : community-mysql-server-5.5.35-1.fc20.x86_64 2/3 
验证中 : community-mysql-common-5.5.35-1.fc20.x86_64 3/3

已安装:
community-mysql-server.x86_64 0:5.5.35-1.fc20

作为依赖被安装:
community-mysql.x86_64 0:5.5.35-1.fc20 
community-mysql-common.x86_64 0:5.5.35-1.fc20

完毕!
[root@localhost ~]# systemctl start mysqld.service
[root@localhost ~]# systemctl enable mysqld.service
ln -s '/usr/lib/systemd/system/mysqld.service' '/etc/systemd/system/multi-user.target.wants/mysqld.service'
[root@localhost ~]# mysql -u root #以root登陆数据库
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.5.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> select user, host, password from mysql.user; #user列表
+------+-----------+----------+
| user | host | password |
+------+-----------+----------+
| root | localhost | |
| root | rachel | |
| root | 127.0.0.1 | |
| root | ::1 | |
| | localhost | |
| | rachel | |
+------+-----------+----------+
rows in set (0.00 sec)

mysql> delete from mysql.user where user=''; #删除空user
Query OK, 2 rows affected (0.00 sec)

mysql> delete from mysql.user where user='root' and host='::1'; #删除IPv6用户(如果不用的话)
Query OK, 1 row affected (0.00 sec)

mysql> select user, host, password from mysql.user;
+------+-----------+----------+
| user | host | password |
+------+-----------+----------+
| root | localhost | |
| root | rachel | |
| root | 127.0.0.1 | |
+------+-----------+----------+
rows in set (0.00 sec)

# 设定密码
mysql> set password for root@localhost=password('XXXXXX');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for root@rachel=password('XXXXXX');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for root@'127.0.0.1'=password('XXXXXXX');
Query OK, 0 rows affected (0.00 sec)

#再次列密码
mysql> select user, host, password from mysql.user;
+------+-----------+-------------------------------------------+
| user | host | password |
+------+-----------+-------------------------------------------+
| root | localhost | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
| root | rachel | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
| root | 127.0.0.1 | *C7E2F6338326EDC0AXXXXXXXXXXXXXXXXXXXXXXX |
+------+-----------+-------------------------------------------+
rows in set (0.00 sec)

mysql> exit
Bye
[root@localhost ~]# mysql -u root -p #再次登录
Enter password: #输入刚才的密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.5.35 MySQL Community Server (GPL)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> exit
Bye
[root@localhost ~]#

 

作者: Candyメ奶糖

本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
博文来源广泛,如原作者认为我侵犯知识产权,请尽快给我发邮件 359031282@qq.com联系,我将以第一时间删除相关内容。

相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助     相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
目录
相关文章
|
4天前
|
关系型数据库 MySQL 数据库
《MySQL 简易速速上手小册》第1章:MySQL 基础和安装(2024 最新版)
《MySQL 简易速速上手小册》第1章:MySQL 基础和安装(2024 最新版)
27 4
|
7天前
|
关系型数据库 MySQL Linux
Linux联网安装MySQL Server
Linux联网安装MySQL Server
20 0
|
7天前
|
关系型数据库 MySQL Linux
centos7安装mysql-带网盘安装包
centos7安装mysql-带网盘安装包
43 2
|
11天前
|
关系型数据库 MySQL 数据库
Docker安装MySQL
Docker安装MySQL
22 1
|
3月前
|
Rust 安全 编译器
如何在 Fedora 上安装 Rust?
如何在 Fedora 上安装 Rust?
46 0
如何在 Fedora 上安装 Rust?
|
弹性计算 NoSQL Redis
ECS安装Fedora CoreOS操作系统版本34
ECS安装Fedora CoreOS操作系统版本34
503 0
ECS安装Fedora CoreOS操作系统版本34
|
弹性计算 JavaScript NoSQL
ECS安装Fedora操作系统版本35
ECS安装Fedora操作系统版本35
184 0
ECS安装Fedora操作系统版本35
|
Oracle Java 关系型数据库
在 CentOS/Fedora 下安装 JAVA 环境
在 CentOS/Fedora 下安装 JAVA 环境介绍本文介绍如何在 CentOS 7(6/6.5)、 Fedora、RHEL 上安装 Java。Java是一个流行的软件平台,允许您运行Java应用程序。
2235 0
|
Web App开发 Python 开发工具
安装 fedora 之后
下载zsh,并安装oh-my-zsh dnf install zsh -y 到github的oh-my-zsh上按照教程安装oh-my-zsh,配置主题为minimal,这个是个人比较喜欢的主题,因为比较简洁 下载pyenv和virtualenv 到github的pyenv上安装pyenv 到...
1037 0
|
PHP 关系型数据库
Fedora 安装 phpMyAdmin(可能只有自己看得懂)
yum groupinstall "Development Tools" yum install php-mysqli php-mbstring php-mcrypt yum install mariadb mariadb-server yum install httpd httpd-devel ...
974 0