mysql-mariadb安装

安装:

1、下载安装包;https://mariadb.org/download/     mariadb 10.2 对应 mysql 5.7

2、查看官网二进制安装教程:https://mariadb.com/kb/en/installing-mariadb-binary-tarballs/  注意提前配置好/etc/my.cnf

1
2
3
4
5
6
7
8
9
10
1 #
 2 # This group is read both by the client and the server
 3 # use it for options that affect everything
 4 #
 5 [client-server]
 6
 7 #
 8 # include *.cnf from the config directory
 9 #
10 !includedir /etc/my.cnf.d

  /etc/my.cnf.d 文件 mysql-clients.cnf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1 #
 2 # These groups are read by MariaDB command-line tools
 3 # Use it for options that affect only one utility
 4 #
 5
 6 [mysql]
 7
 8 [mysql_upgrade]
 9
10 [mysqladmin]
11
12 [mysqlbinlog]
13
14 [mysqlcheck]
15
16 [mysqldump]
17
18 [mysqlimport]
19
20 [mysqlshow]
21
22 [mysqlslap]
23

  /etc/my.cnf.d 文件 server.cnf

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
1 #
 2 # These groups are read by MariaDB server.
 3 # Use it for options that only the server (but not clients) should see
 4 #
 5 # See the examples of server my.cnf files in /usr/share/mysql/
 6 #
 7
 8 # this is read by the standalone daemon and embedded servers
 9 [server]
10
11 # this is only for the mysqld standalone daemon
12 [mysqld]
13 innodb_file_per_table = ON
14 skip_name_resolve = ON
15 character_set_server = utf8
16 basedir = /usr/local/mysql
17 datadir = /Data/mysqlData
18 default_storage_engine = innodb
19
20 #
21 # * Galera-related settings
22 #
23 [galera]
24 # Mandatory settings
25 #wsrep_on=ON
26 #wsrep_provider=
27 #wsrep_cluster_address=
28 #binlog_format=row
29 #default_storage_engine=InnoDB
30 #innodb_autoinc_lock_mode=2
31 #
32 # Allow server to accept connections on all interfaces.
33 #
34 #bind-address=0.0.0.0
35 #
36 # Optional setting
37 #wsrep_slave_threads=1
38 #innodb_flush_log_at_trx_commit=0
39
40 # this is only for embedded server
41 [embedded]
42
43 # This group is only read by MariaDB servers, not by MySQL.
44 # If you use the same .cnf file for MySQL and MariaDB,
45 # you can put MariaDB-only options here
46 [mariadb]
47
48 # This group is only read by MariaDB-10.2 servers.
49 # If you use the same .cnf file for MariaDB of different versions,
50 # use this group for options that older servers don't understand
51 [mariadb-10.2]

    

3、运行安装脚本:mysql]# ./scripts/mysql_install_db --ldata=/Data/mysql --skip-name-resolve --user=mysql

4、配置service文件,启动服务;

5、运行安全脚本:mysql_secure_installation

6、设置密码登录,安装完成之后,本机不需要输入密码即可登录,即使已经运行了安全脚本设置了root账户的密码;

1
2
3
4
5
6
7
8
9
10
11
12
13
MariaDB [mysql]> SELECT PASSWORD('root');
+-------------------------------------------+
| PASSWORD('root')                          |
+-------------------------------------------+
| *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B |
+-------------------------------------------+
1 row in set (0.00 sec)
 
MariaDB [mysql]> ALTER USER root@localhost IDENTIFIED VIA mysql_native_password USING '*81F5E21E35407D884A6CD4A731AEBFB6AF209E1B';
Query OK, 0 rows affected (0.00 sec)
 
MariaDB [mysql]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

  

安装完成

mariadb配置文件:https://mariadb.com/kb/en/configuring-mariadb-with-option-files/

 

posted @   青灯浊酒  阅读(193)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· DeepSeek 开源周回顾「GitHub 热点速览」
点击右上角即可分享
微信分享提示