设为首页收藏本站

LUPA开源社区

 找回密码
 注册
文章 帖子 博客
LUPA开源社区 首页 业界资讯 技术文摘 查看内容

Linux 环境下快速部署 MySQL 的替代方案

2013-9-3 11:09| 发布者: 红黑魂| 查看: 3633| 评论: 0|来自: 51CTO

摘要: MariaDB名称来自Michael Widenius的女儿Maria的名字。图1 是MariaDB 的LOGO: 图1 MariaDB 的LOGO MariaDB 下载:https://downloads.mariadb.org/ MariaDB 网站:http://www.mariadb.org/ MariaDB最新稳定版为:Mar ...

二 主要 Linux 发行版本安装MariaDB

本文主要介绍两大主要Linux 发行版本类别:

  • 使用rpm 软件包格式的RHEL/CentOS/Fedora
  • 使用deb软件包格式的Debian /Ubuntu 。

1、使用rpm 软件包格式的RHEL/CentOS/Fedora

(1)这里以Fedora 19为例

其中使用Fedora 19 是最简单的,因为这个最新Linux 发行版本可以直接使用yum 软件包工具安装

a、安装软件包

  1. #yum -y install mariadb-server mariadb 
  2. #systemctl start mysqld.service 
  3. #systemctl enable mysqld.service 
  4. ln -s '/lib/systemd/system/mysqld.service' '/etc/systemd/system
  5. /multi-user.target.wants/mysqld.service' 

2、数据库的基本操作

首次连接MariaDB如图4:

  1. #mysql -u root 

图4首次连接MariaDB

可以看到mariadb 版本号是5.5.31-MariaDB MariaDB Server,其他基本操作(和Mysql操作相同)。

查看用户信息

使用内部命令:select user,host,password from mysql.user; 如图5:

图5查看用户信息

设置root用户密码

  1. MariaDB [(none)]> set password for root@localhost=password('password'); 
  2. Query OK, 0 rows affected (0.00 sec) 
  3. # set root password 
  4. MariaDB [(none)]> set password for root@'127.0.0.1'=password('password'); 
  5. Query OK, 0 rows affected (0.00 sec) 

删除一些数据库用户(ipv6 和 匿名用户)

  1. MariaDB [(none)]> delete from mysql.user where user='root' and host='::1'
  2. Query OK, 1 rows affected (0.00 sec) 
  3. MariaDB [(none)]> delete from mysql.user where user=''
  4. Query OK, 2 rows affected (0.00 sec) 

退出后使用root密码重新登录

  1. #mysql -u root -p 
  2. Enter password: 
  3. # MariaDB root password you set 
  4. Welcome to the MariaDB monitor.  Commands end with ; or \g. 
  5. Your MariaDB connection id is 3 
  6. Server version: 5.5.31-MariaDB MariaDB Server 
  7. Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others. 
  8. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
  9. MariaDB [(none)]> 


酷毙

雷人

鲜花

鸡蛋

漂亮
  • 快毕业了,没工作经验,
    找份工作好难啊?
    赶紧去人才芯片公司磨练吧!!

最新评论

关于LUPA|人才芯片工程|人才招聘|LUPA认证|LUPA教育|LUPA开源社区 ( 浙B2-20090187 浙公网安备 33010602006705号   

返回顶部