国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

centos7 mysql數據庫安裝和配置

2019-11-02 16:53:26
字體:
來源:轉載
供稿:網友

一、系統環境

yum update升級以后的系統版本為

[root@yl-web yl]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) 

二、mysql安裝

一般網上給出的資料都是

#yum install mysql#yum install mysql-server#yum install mysql-devel

安裝mysql和mysql-devel都成功,但是安裝mysql-server失敗,如下: 

[root@yl-web yl]# yum install mysql-serverLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirrors.sina.cn * extras: mirrors.sina.cn * updates: mirrors.sina.cnNo package mysql-server available.Error: Nothing to do

查資料發現是CentOS 7 版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替了。

有兩種解決辦法:

1、方法一:安裝mariadb

MariaDB數據庫管理系統是MySQL的一個分支,主要由開源社區在維護,采用GPL授權許可。開發這個分支的原因之一是:甲骨文公司收購了MySQL后,有將MySQL閉源的潛在風險,因此社區采用分支的方式來避開這個風險。MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。

安裝mariadb,大小59 M。

[root@yl-web yl]# yum install mariadb-server mariadb 

mariadb數據庫的相關命令是:

systemctl start mariadb #啟動MariaDBsystemctl stop mariadb #停止MariaDBsystemctl restart mariadb #重啟MariaDBsystemctl enable mariadb #設置開機啟動

所以先啟動數據庫

[root@yl-web yl]# systemctl start mariadb

然后就可以正常使用mysql了 

[root@yl-web yl]# mysql -u root -pEnter password: Welcome to the MariaDB monitor. Commands end with ; or /g.Your MariaDB connection id is 3Server version: 5.5.41-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.MariaDB [(none)]> show databases;+--------------------+| Database  |+--------------------+| information_schema || mysql  || performance_schema || test  |+--------------------+4 rows in set (0.00 sec)MariaDB [(none)]> 

安裝mariadb后顯示的也是 MariaDB [(none)]> ,可能看起來有點不習慣。下面是第二種方法。

2、方法二:官網下載安裝mysql-server

# wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm -ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server

安裝成功后重啟mysql服務。

# service mysqld restart

初次安裝mysql,root賬戶沒有密碼。 

[root@yl-web yl]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or /g.Your MySQL connection id is 3Server version: 5.6.26 MySQL Community Server (GPL)Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '/h' for help. Type '/c' to clear the current input statement.mysql> show databases;+--------------------+| Database  |+--------------------+| information_schema || mysql  || performance_schema || test  |+--------------------+4 rows in set (0.01 sec)mysql> 
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 洪洞县| 南乐县| 镇远县| 吉隆县| 林甸县| 芜湖市| 桓台县| 衡东县| 木兰县| 临安市| 绿春县| 百色市| 禄劝| 吉木萨尔县| 阜南县| 元阳县| 驻马店市| 哈尔滨市| 运城市| 桂东县| 东辽县| 彭山县| 舒城县| 云龙县| 苏尼特右旗| 台东县| 杭州市| 上栗县| 城口县| 四川省| 澄江县| 华蓥市| 阳东县| 上饶县| 黄浦区| 清河县| 斗六市| 察隅县| 盘锦市| 盐边县| 垫江县|