在虚拟机上安装和配置MySQL

mysql的安装与配置

#yum install -y mariadb mariadb-server python2-PyMySQL

配置数据库

编辑文件/etc/my.cnf.d/openstack.cnf,完成如下配置

在这里插入图片描述
(上面图片内的文字 可复制)
[mysqld]
bind-address = 10.0.0.104
default-storage-engine = innodb
innodb_file_per_table = on
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

设置开机启动

#systemctl enable mariadb.service
#systemctl start mariadb.service
#:

在这里插入图片描述

安装数据库服务

[root@controller ~]# mysql_secure_installation

Set root password? [Y/n] y

Remove anonymous users? [Y/n] y

… Success!

Disallow root login remotely? [Y/n] y

… Success!

Remove test database and access to
it? [Y/n] y

  • Dropping test database…

… Success!

  • Removing privileges on test database…

… Success!

Reload privilege tables now? [Y/n] y

… Success!

Cleaning up…

All done! If you’ve completed all of the above steps,
your MariaDB

installation should now be secure.

Thanks for using MariaDB!

[root@linux-node1 etc]# cd

[root@linux-node1 ~]# mysql -u root -p

Enter password:

Welcome to the MariaDB
monitor. Commands end with ; or \g.

Your MariaDB connection id is 12

Server version: 10.1.20-MariaDB
MariaDB Server

Copyright © 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;

在这里插入图片描述

3.3 相关数据库的建立及授权

MariaDB [(none)]> create database keystone;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on keystone.* to keystone@localhost identified by
‘keystone’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on keystone.* to keystone@’%’ identified by ‘keystone’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database glance;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on glance.*
to glance@localhost identified by ‘glance’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on glance.*
to glance@’%’ identified by ‘glance’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database nova;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on nova.* to
nova@localhost identified by ‘nova’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on nova.* to
nova@’%’ identified by ‘nova’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> create database
neutron;

Query OK, 1 row affected (0.00 sec)

MariaDB [(none)]> grant all on neutron.*
to neutron@localhost identified by ‘neutron’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> grant all on neutron.*
to neutron@’%’ identified by ‘neutron’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;
在这里插入图片描述

Exit 退出数据库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值