国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

Centos7 mysql數(shù)據(jù)庫安裝及配置實現(xiàn)教程

瀏覽:72日期:2023-10-12 13:45:57

一、系統(tǒng)環(huán)境

yum update升級以后的系統(tǒng)版本為

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

二、mysql安裝

一般網(wǎng)上給出的資料都是

#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

查資料發(fā)現(xiàn)是CentOS 7 版本將MySQL數(shù)據(jù)庫軟件從默認(rèn)的程序列表中移除,用mariadb代替了。

有兩種解決辦法:

1、方法一:安裝mariadb

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

安裝mariadb,大小59 M。

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

mariadb數(shù)據(jù)庫的相關(guān)命令是:

systemctl start mariadb #啟動MariaDB

systemctl stop mariadb #停止MariaDB

systemctl restart mariadb #重啟MariaDB

systemctl enable mariadb #設(shè)置開機(jī)啟動

所以先啟動數(shù)據(jù)庫

[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)]>,可能看起來有點不習(xí)慣。下面是第二種方法。

2、方法二:官網(wǎng)下載安裝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服務(wù)。

# 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>

設(shè)置密碼

mysql> set password for ’root’@’localhost’ =password(’password’);Query OK, 0 rows affected (0.00 sec)mysql>

不需要重啟數(shù)據(jù)庫即可生效。

在mysql安裝過程中如下內(nèi)容:

Installed: mysql-community-client.x86_64 0:5.6.26-2.el7mysql-community-devel.x86_64 0:5.6.26-2.el7 mysql-community-libs.x86_64 0:5.6.26-2.el7 mysql-community-server.x86_64 0:5.6.26-2.el7Dependency Installed: mysql-community-common.x86_64 0:5.6.26-2.el7 Replaced: mariadb.x86_64 1:5.5.41-2.el7_0 mariadb-devel.x86_64 1:5.5.41-2.el7_0 mariadb-libs.x86_64 1:5.5.41-2.el7_0 mariadb-server.x86_64 1:5.5.41-2.el7_0

所以安裝完以后mariadb自動就被替換了,將不再生效。

[root@yl-web yl]# rpm -qa |grep mariadb[root@yl-web yl]#

三、配置mysql

1、編碼

mysql配置文件為/etc/my.cnf

最后加上編碼配置

[mysql]default-character-set =utf8

這里的字符編碼必須和/usr/share/mysql/charsets/Index.xml中一致。

Centos7 mysql數(shù)據(jù)庫安裝及配置實現(xiàn)教程

2、遠(yuǎn)程連接設(shè)置

把在所有數(shù)據(jù)庫的所有表的所有權(quán)限賦值給位于所有IP地址的root用戶。

mysql> grant all privileges on *.* to root@’%’identified by ’password’;

如果是新用戶而不是root,則要先新建用戶

mysql>create user ’username’@’%’ identified by ’password’;

此時就可以進(jìn)行遠(yuǎn)程連接了。

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持好吧啦網(wǎng)。

標(biāo)簽: MySQL 數(shù)據(jù)庫
相關(guān)文章:
主站蜘蛛池模板: 综合91| 成人精品 | 欧美日韩一级黄色片 | 免费精品久久久久久中文字幕 | 成人二区| 欧美乱大交xxxxx在线观看 | 在线观看 a国v | 国产亚洲精品久久 | 国产91久久精品 | 欧美黑粗特黄午夜大片 | 亚洲精品精品一区 | 爱逼综合网 | 国产美女一级特黄毛片 | 精品一区二区三区在线视频 | 成年午夜性视频免费播放 | 乱子伦一级在线现看 | 日韩毛片高清在线看 | 日本 片 成人 在线 日本68xxxxxxxxx老师 | 手机看黄av免费网址 | 日本免费在线观看视频 | 成人合成mv福利视频网站 | 99精品网站| 蜜臀91精品国产高清在线观看 | 欧美日韩一区二区视频免费看 | 亚洲欧美激情精品一区二区 | 亚洲国产美女视频 | 黄色毛片视频校园交易 | 国产成人福利美女观看视频 | 久久久久久a亚洲欧洲aⅴ | 国产精品揄拍一区二区 | 亚洲性久久 | 日本高清视频免费在线观看 | 久久影院一区二区三区 | 免费播放巨茎人妖不卡片 | 真实一级一级一片免费视频 | 欧美日韩亚洲综合久久久 | 国产日韩欧美精品一区二区三区 | 亚洲手机在线观看 | 肥婆毛片| 欧美精品亚洲精品日韩一区 | 欧美成人交tv免费观看 |