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)