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)