日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mini CentOS7 安装 mysql

發布時間:2025/3/21 数据库 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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)







  • #?yum?install?mariadb-server?-y?//如果已安裝可以省略??
  • #?systemctl?start?mariadb.service?//啟動服務??
  • #?systemctl?enable?mariadb.service?//開機啟動服務??
  • #?mysql?-u?root?-p?//登錄mysql??

  • 總結

    以上是生活随笔為你收集整理的mini CentOS7 安装 mysql的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。