200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 1+X云计算平台运维与开发认证 数据库管理

1+X云计算平台运维与开发认证 数据库管理

时间:2023-03-31 11:22:14

相关推荐

1+X云计算平台运维与开发认证 数据库管理

使用VMWare创建两台centos7的系统的虚拟机,安装数据库服务,并将两台数据库配置为主从数据库模式(master和slave)。配置完成后,在从节点,执行show status slave\G查看从节点的复制状态。将查看从节点服务状态的返回结果以文本形式提交的答题框。(数据库用户名root,密码000000;关于数据库的命令均使用小写)

mysql1:

[root@localhost ~]# hostnamectl set-hostname mysql1[root@localhost ~]# login[root@mysql1 ~]# vim /etc/hosts127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4::1 localhost localhost.localdomain localhost6 localhost6.localdomain6192.168.49.133 mysql1192.168.49.132 mysql2

[root@mysql1 ~]# systemctl stop firewalld[root@mysql1 ~]# systemctl disable firewalld[root@mysql1 ~]# setenforce 0[root@mysql1 ~]# vim /etc/selinux/config

SELINUX=Permissive

[root@mysql1 ~]# yum install -y mariadb mariadb-server已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: * extras: * updates: 软件包 1:mariadb-5.5.68-1.el7.x86_64 已安装并且是最新版本软件包 1:mariadb-server-5.5.68-1.el7.x86_64 已安装并且是最新版本无须任何处理

[root@mysql1 ~]# systemctl restart mariadb[root@mysql1 ~]# mysql_secure_installation[root@mysql1 ~]# yum install -y mariadb mariadb-server已加载插件:fastestmirror, langpacksLoading mirror speeds from cached hostfile* base: * extras: * updates: 软件包 1:mariadb-5.5.68-1.el7.x86_64 已安装并且是最新版本软件包 1:mariadb-server-5.5.68-1.el7.x86_64 已安装并且是最新版本无须任何处理[root@mysql1 ~]# systemctl restart mariadb[root@mysql1 ~]# mysql_secure_installationNOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDBSERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY! #注意:对于所有脚本,建议运行此脚本的所有部分服务器在生产中使用!请仔细阅读每一步!In order to log into MariaDB to secure it, we'll need the currentpassword for the root user. If you've just installed MariaDB, andyou haven't set the root password yet, the password will be blank,so you should just press enter here. #为了登录MariaDB来保护它,我们需要根用户的密码。如果你刚刚安装了MariaDB您尚未设置根密码,密码将为空,所以你应该在这里按回车键。Enter current password for root (enter for none): #回车键#输入根目录的当前密码(输入表示无):OK, successfully used password, moving on... #好的,成功使用密码,继续。。。Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation. #设置root密码可以确保没有人可以登录到MariaDB没有适当授权的root用户。New password: #新密码:Re-enter new password: #重新输入新密码:Password updated successfully!#密码更新成功!Reloading privilege tables.. #正在重新加载权限表。。... Success! # ... 成功!By default, a MariaDB installation has an anonymous user, allowing anyoneto log into MariaDB without having to have a user account created forthem. This is intended only for testing, and to make the installatiogo a bit smoother. You should remove them before moving into aproduction environment.n #默认情况下,MariaDB安装有一个匿名用户,允许任何人无需创建用户帐户即可登录MariaDB他们。这仅用于测试和安装再平稳一点。你应该在搬进生产环境。Remove anonymous users? [Y/n]#y删除匿名用户?是/否... Success!#... 成功!Normally, root should only be allowed to connect from 'localhost'. This#通常,只允许root从“localhost”连接。这个确保有人无法从网络中猜到根密码。ensures that someone cannot guess at the root password from the network.#确保有人无法从网络中猜到根密码。Disallow root login remotely? [Y/n] y #不允许远程根用户登录?是/否... Success!#... 成功!By default, MariaDB comes with a database named 'test' that anyone canaccess. This is also intended only for testing, and should be removedbefore moving into a production environment.#默认情况下,MariaDB附带了一个名为“test”的数据库,任何人都可以使用它进入。这也仅用于测试,应将其移除在进入生产环境之前。Remove test database and access to it? [Y/n] y #删除测试数据库并访问它?是/否- Dropping test database... # - -正在删除测试数据库。。。... Success! # ... 成功!- Removing privileges on test database... # - -正在删除对测试数据库的权限。。。... Success! #... 成功!Reloading the privilege tables will ensure that all changes made so far #重新加载特权表将确保到目前为止所做的所有更改will take effect immediately. #立即生效。Reload privilege tables now? [Y/n] #现在重新加载特权表?是/否... Success! #... 成功!Cleaning up...#清理…谗谢使MariaDBAll done! If you've completed all of the above steps, your MariaDBinstallation should now be secure.#一切就绪!如果您已经完成了上述所有步骤,您的MariaDB安装现在应该是安全的。Thanks for using MariaDB!#感谢使用MariaDB!

[root@mysql1 ~]# vim /etc/f

log_bin = mysql-bin

binlog_ignore_db = mysql

server_id = 10

[root@mysql1 ~]# mysql -uroot -p000000Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 11Server version: 5.5.68-MariaDB MariaDB ServerCopyright (c) 2000, , Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> grant all privileges on *.* to 'root'@'%' identified by '000000';Query OK, 0 rows affected (0.00 sec)# 注释:如果你不想配置上面的host文件可以不使用主机名mysql2的形式,可以直接打IP地址,用户可以随意指定,只是一个用于连接的而已MariaDB [(none)]> grant replication slave on *.* to 'user'@'mysql2' identified by '000000';Query OK, 0 rows affected (0.00 sec)

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。