Linux mysql データベースと開発キットのインストール

注: 以下の操作はすべて root ユーザーとして実行されます。

以下の手順に従ってコマンドラインに入力してください。
ダウンロード
1:

sudo yum install -y mariadb

2:

sudo yum install -y mariadb-server

3:

sudo yum install -y mariadb-devel

次の設定ファイル
: 対応するコマンド4 を対応する構成ファイルに追加します。

sudo vim /etc/my.cnf.d/client.cnf


# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#
[client]
# 新增下边一行配置,设置客户端默认字符集为utf8
default-character-set = utf8
# This group is not read by mysql client library,
# If you use the same .cnf file for MySQL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]

5:

sudo vim /etc/my.cnf.d/mysql-clients.cnf

# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#
[mysql]
# 新增配置
default-character-set = utf8
[mysql_upgrade]
[mysqladmin]
[mysqlbinlog]
[mysqlcheck]
[mysqldump]
[mysqlimport]
[mysqlshow]
[mysqlslap]

6:

sudo vim /etc/my.cnf.d/server.cnf

# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#
# this is read by the standalone daemon and embedded servers
[server]
# this is only for the mysqld standalone daemon
[mysqld]
# 新增以下四行配置
collation-server = utf8_general_ci
init-connect = 'SET NAMES utf8'
character-set-server = utf8
sql-mode = TRADITIONAL
# this is only for embedded server
[embedded]
# This group is only read by MariaDB-5.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mysqld-5.5]
# These two groups are only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]
[mariadb-5.5]

⭐️
起動:

サービスを開始します。

sudo systemctl 起動 mariadb

サービスが自動的に開始されるように設定します。

systemctl で mariadb を有効にする

サービスステータスの表示:

systemctl ステータス mariadb

テスト接続

mysql -uroot
結果:

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 190
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

おすすめ

転載: blog.csdn.net/qq_43727529/article/details/129552085