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

您的位置:首頁技術文章
文章詳情頁

Centos7 mysql數據庫安裝及配置實現教程

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

一、系統環境

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 #啟動MariaDB

systemctl stop mariadb #停止MariaDB

systemctl restart mariadb #重啟MariaDB

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

設置密碼

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

不需要重啟數據庫即可生效。

在mysql安裝過程中如下內容:

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數據庫安裝及配置實現教程

2、遠程連接設置

把在所有數據庫的所有表的所有權限賦值給位于所有IP地址的root用戶。

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

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

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

此時就可以進行遠程連接了。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持好吧啦網。

標簽: MySQL 數據庫
相關文章:
主站蜘蛛池模板: 欧美国产日韩在线播放 | 一级成人a毛片免费播放 | 成人免费真人毛片视频 | 成年人视频在线观看免费 | 欧美理论在线 | 羞羞一区二区三区四区片 | 久夜色精品国产一区二区三区 | 九九精品视频在线播放8 | 美女在线看永久免费网址 | 伊人久久国产免费观看视频 | 亚洲精品国产成人7777 | 日韩在线无 | 欧美一区二区三区视频在线 | www操操操| 欧美影院久久 | 免费高清毛片在线播放视频 | 国产一级在线观看 | 成人永久福利在线观看不卡 | 在线播放成人高清免费视频 | 一级特级毛片 | 成视频年人黄网站免费 | 日韩美a一级毛片 | 九九九九精品视频在线播放 | 美女黄网站视频 | 中文字幕水野优香在线网在线 | 免费视频久久 | 视频一区视频二区在线观看 | 欧美成人欧美激情欧美风情 | 三级高清| 久久综合色88 | 免费观看女人一摸全是水 | 点击进入不卡毛片免费观看 | 国产情侣无套精品视频 | 久草在线免费播放 | 中文字幕人成乱码在线观看 | 亚洲国产成人久久综合一 | 99精品视频一区在线视频免费观看 | 久久精品视| 免费看美女午夜大片 | 日本国产免费一区不卡在线 | 国产一级毛片夜一级毛片 |