centos7 安装 mariadb-10

下载地址:

http://mirrors.ustc.edu.cn/mariadb/mariadb-10.0.19/source/mariadb-10.0.19.tar.gz

因为用cmake所以线安装下这个
可以

yum install cmake

下载了tar.gz文件解压到指定的目录tar
-zxvf XXX.tar.gz

进入到安装目录

[[email protected]]$ pwd

/app/mysql/mariadb-10.0.19

//创建下用户 分组,需要安装的目录,和数据库目录

[[email protected]]$ sudo groupadd mysql

[sudo] password forhcr:

[[email protected]]$ sudo useradd -g mysql mysql -s /bin/false

[h[email protected]]$ mkdir -p /app/data/mysql

[[email protected]]$ sudo chown -R mysql:mysql /app/data/mysql/

[[email protected]]$ mkdir /app/local/mysql

cmake. -DCMAKE_INSTALL_PREFIX=/app/local/mysql-DMYSQL_DATADIR=/app/data/mysql/ -DSYSCONFDIR=/etc

这儿可能会碰到 缺少ncurses(报Curseslibrary
not found异常)的问题,可以安装下,

yum installncurses-devel
或者现在rpm
指定安装

[[email protected]]$ make

//此处有点慢,我去坑爹阿,太长时间了等把,早知道应该选择

[[email protected]]$ make install

//一堆的installing

[[email protected]]$ cd /app/local/mysql/

[[email protected]]$ sudo cp support-files/my-huge.cnf /etc/my.cnf

[[email protected]]$ sudo vi /etc/my.cnf //编辑配置文件,在[mysqld]部分增加
datadir= /app/data/mysql  //添加MariaDB数据库路径

datadir =/app/data/mysql

[[email protected]]$ sudo cp support-files/my-huge.cnf /etc/my.cnf

[[email protected]]$ sudo cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld

[[email protected]]$ sudo chmod 755 /etc/init.d/mysqld

[[email protected]]$ sudo chkconfig mysqld on

[[email protected]]$ sudo vi /etc/rc.d/init.d/mysqld

这个地方默认是

basedir=

datadir=

改成

basedir =/app/local/mysql  #MariaDB程序安装路径

datadir= /app/data/mysql  #MariaDB数据库存放目录

//服务启动

[[email protected]]$ sudo service mysqld start

Starting MySQL.SUCCESS!

//配置到环境中

[[email protected]]$ sudo vi /etc/profile //增加了一个环境变量

exportPATH=$PATH:/app/local/mysql/bin

到这儿重起下机器

[[email protected]]$ sudo shutdown -r now

初始化mysqlroot密码

[[email protected] ~]#mysql_secure_installation

NOTE: RUNNING ALLPARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB

SERVERS INPRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log intoMariaDB to secure it, we‘ll need the current

password for theroot user. If you‘ve just installed MariaDB, and

you haven‘t set theroot password yet, the password will be blank,

so you should justpress enter here.

Enter currentpassword for root (enter for none):

ERROR 1045 (28000):Access denied for user ‘root‘@‘localhost‘ (using password: YES)

Enter currentpassword for root (enter for none):

ERROR 1045 (28000):Access denied for user ‘root‘@‘localhost‘ (using password: YES)

//初始化直接enter就好了

Enter currentpassword for root (enter for none):

OK, successfullyused password, moving on...

Setting the rootpassword ensures that nobody can log into the MariaDB

root user withoutthe proper authorisation.

Set root password?[Y/n] y

New password:

Re-enter newpassword:

Password updatedsuccessfully!

Reloading privilegetables..

... Success!

By default, aMariaDB installation has an anonymous user, allowing anyone

to log into MariaDBwithout having to have a user account created for

them. This isintended only for testing, and to make the installation

go a bit smoother. You should remove them before moving into a

productionenvironment.

Remove anonymoususers? [Y/n] y

... Success!

Normally, rootshould only be allowed to connect from ‘localhost‘. This

ensures that someonecannot guess at the root password from the network.

Disallow root loginremotely? [Y/n] y

... Success!

By default, MariaDBcomes with a database named ‘test‘ that anyone can

access. This isalso intended only for testing, and should be removed

before moving into aproduction environment.

Remove test databaseand access to it? [Y/n] n

... skipping.

Reloading theprivilege tables will ensure that all changes made so far

will take effectimmediately.

Reload privilegetables now? [Y/n] y

... Success!

Cleaning up...

All done! If you‘vecompleted all of the above steps, your MariaDB

installation shouldnow be secure.

Thanks for usingMariaDB!

[[email protected] ~]#

[[email protected] ~]#service mysqld restart

Shutting downMySQL.. SUCCESS!

Starting MySQL.SUCCESS!

[[email protected]~]# mysql -u root -p

Enter password:

Welcome to theMariaDB monitor. Commands end with ; or \g.

Your MariaDBconnection id is 5

Server version:10.0.19-MariaDB-log Source distribution

Copyright (c) 2000,2015, Oracle, MariaDB Corporation Ab and others.

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

MariaDB [(none)]>show tables

-> ;

ERROR 1046 (3D000):No database selected

MariaDB [(none)]>show databases;

+--------------------+

| Database |

+--------------------+

| information_schema|

| mysql |

| performance_schema|

| test |

+--------------------+

4 rows in set (0.04sec)

MariaDB [(none)]> //创建个测试库连接下

MariaDB [(none)]>create database r_test;

Query OK, 1 rowaffected (0.01 sec)

MariaDB [(none)]>grant all privileges on r_test.* to ‘r_test‘@‘localhost‘ identifiedby ‘r_test‘;

Query OK, 0 rowsaffected (0.00 sec)

MariaDB [(none)]>grant all privileges on r_test.* to ‘r_test‘@‘%‘ identified by‘r_test‘;

Query OK, 0 rowsaffected (0.00 sec)

用navicat连接下

安装方式拜读参考:

http://www.linuxidc.com/Linux/2014-11/109049.htm

时间: 2024-10-21 15:54:57

centos7 安装 mariadb-10的相关文章

Centos7安装mariadb galera cluster数据库集群 & 详解

#Galera集群特点 集群之间无延时,同步复制.而master-slave主从异步复制,存在延迟. active-active多主,集群内部服务器都是同时写,必须等所有集群内所有数据库都完成数据写入,才会反馈完成,所以不存在数据丢失的情况. 集群节点自动故障转移,如果集群中单个节点故障,失效节点会自动被清除. 扩展方便,只要将新的节点添加到集群,新节点自动复制数据. #Galera集群原理     #主要通过galera插件保证数据的一致性,该数据复制的过程是可认证的复制,原理如下: #解析

使用RPM包离线安装MariaDB 10.0.20 , 基于CentOS 6.6-x86-64

使用RPM包[离线]安装 MariaDB 10.0.20,基于CentOS 6.6-x86-64 Minimal 湘中朱生 2015-07-01 于深圳福田 QQ: 872007255 MariaDB交流群: 198111730 文档说明: 1. 网上有很多关于MariaDB/Mysql数据库的安装技术博客文档,主要有源码编译安装和Yum源安装,有些写得很规范优秀,但很少有基于离线RPM包安装的. 2. 源码编译安装对于初学者而言门槛过高, 很容易打击MariaDB初学者学习探索的积极性; Yu

CentOS 6.4 安装 MariaDB 10.3

本文介绍如何使用yum在CentOS 6.4 安装 MariaDB 10.3 1. 创建mysql组 groupadd mysql 2. 创建mysql用户并添加到mysql组 useradd -g mysql mysql 3.修改mysql密码 passwd mysql 4. 配置 MariaDB 10.3 yum vi /etc/yum.repos.d/MariaDB.repo # MariaDB 10.3 CentOS repository list - created 2018-06-0

CentOS 7安装MariaDB 10详解以及相关配置

CentOS 7安装MariaDB 10详解以及相关配置 第一步:添加 MariaDB yum 仓库 首先在CentOS操作系统中/etc/yum.repos.d/目录下添加 MariaDB 的YUM配置文件MariaDB.repo文件. vi /etc/yum.repos.d/MariaDB.repo 在该文件中添加以下内容保存: [mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/10.2/centos7-amd64gpgkey=h

centos7安装mariadb

Mariadb 1.配置数据库yum源 [[email protected] ~]# cat /etc/yum.repos.d/MariaDB.repo  # MariaDB 10.1 CentOS repository list - created 2016-05-12 09:28 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10

CentOS7 安装MariaDB

MariaDB数据库管理系统是MySQL的一个分支.开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险.MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品.一些如谷歌.维基.LinkedIn.Mozilla等的顶级的网站已经迁移到MariaDB了 安装MySQL,发现是CentOS 7 版本将MySQL数据库软件从默认的程序列表中移除,用mariadb代替.毫不客气,折腾小海狮.

RHEL7使用国内yum源,安装Mariadb 10.2.25, 并配置字符集为utf8mb4

目前阿里, 清华,163等镜像站的Mariadb都是5.5的,有些项目需要用到更新的版本,所以顺便安装一下10版本的,并记录过程 添加中科大的Mariadb 10.2.25 yum源,并yum安装 [mariadb] name = MariaDB baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64 gpgkey = https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-

centos7 安装mariaDB 以及 phpmyadmin的安装

一:安装mariadb, mariadb 是 mysql 的一个分支,基本和mysql一样的 1. yum -y install mariadb-server 2. vi /etc/my.cnf.d/server.cnf 在第13行添加 character-set-server=utf8 3.启动mariadb服务 service mariadb start systemctl enable mariadb 4: 配置 mariadb mysql_secure_installation 设置 m

centos7 安装mariadb数据库

1.安装mariadb数据库 yum install -y maraidb mariadb-server 2.登录Mariadb,报Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 错误 [[email protected] ~]# mysql -uroot -pEnter password: ERROR 2002 (HY000): Can't connect to local M

centos7 安装 mariadb 的正确命令

使用的是linode的centos7系统,安装mysql发现已经默认的是mariadb. 但是不管是使用linode官网说明还是百度搜索到的的根本安装方法无法安装成功. 总是提示这一句: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 最后通过google 搜索 install mariadb on centos 7得到了安装的关键一步.