CentOS7下安裝MariaDB和使用

2021-09-24 21:27:03 字數 1575 閱讀 7576

安裝命令 

yum -y install mariadb mariadb-server

安裝完成mariadb,首先啟動mariadb 

systemctl start mariadb

設定開機啟動

systemctl enable mariadb

接下來進行mariadb的相關簡單配置

mysql_secure_installation

首先是設定密碼,會提示先輸入密碼

enter current password for root (enter for none):<–初次執行直接回車

設定密碼

set root password? [y/n] <– 是否設定root使用者密碼,輸入y並回車或直接回車

new password: <– 設定root使用者的密碼

re-enter new password: <– 再輸入一次你設定的密碼

其他配置

remove anonymous users? [y/n] <– 是否刪除匿名使用者

disallow root login remotely? [y/n] <–是否禁止root遠端登入

remove test database and access to it? [y/n] <– 是否刪除test資料庫

初始化mariadb完成,接下來測試登入

mysql -u root -p

建立資料庫:mariadb [(none)]>create database metercenter;(注意分號)

使用該資料庫:mariadb [(none)]>use metercenter;

執行mysql指令碼:mariadb [(none)]>source metercenter.sql;(注意sql的目錄)

修改使用者密碼:

mariadb [(none)]> use mysql;

mariadb [(none)]> update user set password=password('root') where user='root' and host = 'localhost';

mariadb [(none)]> flush privileges;

退出 重新登入進行驗證

在mariadb配置檔案/etc/my.cnf的[mysqld]配置中加入一行:skip-grant-tables

重啟服務:systemctl restart mariadb

mariadb [(none)]> mysql;

mariadb [(none)]> update user set password=password('root') where user='root' and host = 'localhost';

mariadb [(none)]> flush privileges;

mariadb [(none)]> quit;

centos7下安裝janusGraph單機版

janusgraph是一款圖資料庫,繼承自titan,支援分布式,可以整合了多種資料庫,大資料平台,如hbase,hadoop,spark,elasticsearch等。詳細介紹大家可參考官方文件janusgraph官方文件。下面我們介紹如何在centos7上安裝配置單機版本的janusgraph....

centos7下安裝tensorflow gpu版

我的版本 cuda 8.0 cudaa6.0 python3.5.1 tensorflow gpu1.4.0 說說遇到的坑 折騰了一下午 1.查資料說是python3.6可以與其他軟體相容,於是我就安裝了python3.6.6版本,結果後面測試import tensorflow時會報錯importe...

在CentOS 7下安裝Redis

在centos下安裝redis也比較簡單,按照步驟一步一步的操作,基本不會出錯。2 解壓,切換目錄 tar xzf redis 2.8 13.tar.gz cd redis 2.8.13 3 編譯 make make install 4 開啟redis.conf修改配置檔案,最關鍵是下面幾行,其他的...