mini CentOS7 安装 mysql


MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可。开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的潜在风险,因此社区采用分支的方式来避开这个风险。

linux环境:

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)


配置yum源,创建下面的文件 :

/etc/yum.repos.d/MariaDB.repo

内容如下:

[riadb]  

name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1




#删除系统自带的包

 yum remove mysql-libs

#安装mysql数据库(注意 MariaDB 区分大小写如果是小写的 mariadb就装成另外一个源的了,这个版本的有问题,折腾死我了)

yum -y install MariaDB-server MariaDB-client


设置mysql不区分大小写:

 vi /etc/my.cnf.d/server.cnf 

在[mysqld]节下加入 :

#让MYSQL大小写敏感(1-不敏感,0-敏感)

lower_case_table_names=1


#启动mysql

service mysql start


#修改mysql root密码

mysqladmin -u root password 12345


#登录mysql

mysql -h localhost -u root -p

#授权任意ip能登录数据库

Grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;

#刷新权限立即生效

flush privileges ;



到这里数据库就装好了 ,测试下

MariaDB [(none)]> show databases;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)



MariaDB [(none)]> use test
Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed



create table t_test (id int(11),userId char(36),lastLoginTime timestamp) engine=innerDB charset=utf8

insert into t_test(1,'abc',now());

select * from t_test;


MariaDB [test]> select * from t_test;
+------+--------+---------------------+
| id   | userId | lastLoginTime       |
+------+--------+---------------------+
|    1 | 2      | 2016-03-17 22:21:32 |
+------+--------+---------------------+
1 row in set (0.00 sec)







  1. # yum install mariadb-server -y //如果已安装可以省略  
  2. # systemctl start mariadb.service //启动服务  
  3. # systemctl enable mariadb.service //开机启动服务  
  4. # mysql -u root -p //登录mysql  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值