mini CentOS7 安装 mysql
2016-03-28 17:34
441 查看
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
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)
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
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)
相关文章推荐
- linux vi 退出和chow用法
- LINUX多线程
- Linux内核分析06
- linux下安装codeblocks
- linux 截取时间段的日志
- Centos7下安装netstat
- Linux操作系统多线程信号总结
- Linux操作系统多线程信号总结
- Linux下的虚拟光驱和虚拟软驱
- Linux下制作虚拟软盘镜像
- Linux:如何获取打开文件和文件描述符数量
- centos本地yum源错误引起问题
- CentOS 7 install LNMP
- linux初学之8——用户和用户组
- linux su和sudo命令的区别
- Aliyun linux5.7 64位 安装 jdk1.7
- 20135302魏静静——linux课程第六周实验及总结
- Linux环境下sendmail发送html格式正文及csv格式附件邮件
- Linux下安装Eclipse IDE for C/C++ Developers
- Serial Notes for Linux Programming Interface