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

歡迎訪問 生活随笔!

生活随笔

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

数据库

centos7 mysql安装

發布時間:2025/7/25 数据库 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 centos7 mysql安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、系統環境

?[root@localhost home]# cat /etc/redhat-release

?CentOS Linux release 7.2.1511 (Core)

二、mysql安裝

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

[root@localhost home]# yum install mysql-server已加載插件:fastestmirror, langpacksRepodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fastbase | 3.6 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/4): base/7/x86_64/group_gz | 155 kB 00:00:01 (2/4): extras/7/x86_64/primary_db | 139 kB 00:00:01 (3/4): base/7/x86_64/primary_db | 5.6 MB 00:00:38 (4/4): updates/7/x86_64/primary_db | 4.7 MB 00:00:39 Loading mirror speeds from cached hostfile* base: mirrors.163.com* extras: mirrors.163.com* updates: mirrors.163.com沒有可用軟件包 mysql-server。錯誤:無須任何處理

出現這樣問題是CentOS 7 版本將MySQL數據庫軟件從默認的程序列表中移除,用mariadb代替了

有兩種解決辦法:

?1、方法一:安裝mariadb

MariaDB數據庫管理系統是MySQL的一個分支,采用GPL授權許可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能輕松成為MySQL的代替品。MariaDB由MySQL的創始人Michael Widenius(英語:Michael Widenius)主導開發,他早前將自己創建的公司MySQL AB賣給了SUN,此后,隨著SUN被甲骨文收購,MySQL的所有權也落入Oracle的手中。MariaDB名稱來自Michael Widenius的女兒Maria的名字。

安裝mariadb,輸入安裝命令

[root@localhost home]# 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

? 默認無密碼

[root@localhost lzh]# mysql -u root -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 6 Server version: 5.5.52-MariaDB MariaDB ServerCopyright (c) 2000, 2016, 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.01 sec)

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@localhost lzh]# mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server 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 its affiliates. Other names may be trademarks of their respective owners.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> set password for 'root'@'localhost' =password('password'); Query OK, 0 rows affected (0.00 sec)

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

[root@localhost lzh]# rpm -qa |grep mariadb

轉載于:https://www.cnblogs.com/steven520213/p/6723043.html

總結

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

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