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 退出数据库