CentOS 7系统下安装 MariaDB数据库的详细教程
文章主要为大家详细介绍了CentOS 7下安装mysql(MariaDB)的详细教程,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。
CentOS 7系统下安装MariaDB教程,分享给大家
1.centos7现状:
新系统无法再使用yum install mysql-server来安装mysql,因为已使用mariadb代替mysql。
2.安装mariadb:
[root@localhost ~]# yum -y install mariadb*Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile* base: mirrors.linode.com* extras: mirrors.linode.com* updates: mirrors.linode.comResolving Dependencies--> Running transaction check---> Package mariadb.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-bench.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-devel.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-embedded.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-embedded-devel.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-libs.x86_64 1:5.5.37-1.el7_0 will be installed---> Package mariadb-server.x86_64 1:5.5.37-1.el7_0 will be installed--> Processing Dependency: perl-DBD-MySQLforpackage: 1:mariadb-server-5.5.37-1.el7_0.x86_64---> Package mariadb-test.x86_64 1:5.5.37-1.el7_0 will be installed--> Running transaction check---> Package perl-DBD-MySQL.x86_64 0:4.023-5.el7 will be installed--> Finished Dependency ResolutionDependencies Resolved==========================================================================================================Package Arch Version Repository Size==========================================================================================================Installing:mariadb x86_64 1:5.5.37-1.el7_0 updates 8.9 Mmariadb-bench x86_64 1:5.5.37-1.el7_0 updates 385 kmariadb-devel x86_64 1:5.5.37-1.el7_0 updates 744 kmariadb-embedded x86_64 1:5.5.37-1.el7_0 updates 3.6 Mmariadb-embedded-devel x86_64 1:5.5.37-1.el7_0 updates 7.4 Mmariadb-libs x86_64 1:5.5.37-1.el7_0 updates 752 kmariadb-server x86_64 1:5.5.37-1.el7_0 updates 11 Mmariadb-testx86_64 1:5.5.37-1.el7_0 updates 7.9 MInstallingfordependencies:perl-DBD-MySQL x86_64 4.023-5.el7 base 140 kTransaction Summary==========================================================================================================Install 8 Packages (+1 Dependent package)Total download size: 40 MInstalled size: 279 MDownloading packages:(1/9): mariadb-bench-5.5.37-1.el7_0.x86_64.rpm | 385 kB 00:00:00(2/9): mariadb-devel-5.5.37-1.el7_0.x86_64.rpm | 744 kB 00:00:00(3/9): mariadb-embedded-5.5.37-1.el7_0.x86_64.rpm | 3.6 MB 00:00:00(4/9): mariadb-5.5.37-1.el7_0.x86_64.rpm | 8.9 MB 00:00:00(5/9): mariadb-libs-5.5.37-1.el7_0.x86_64.rpm | 752 kB 00:00:00(6/9): mariadb-server-5.5.37-1.el7_0.x86_64.rpm | 11 MB 00:00:00(7/9): mariadb-embedded-devel-5.5.37-1.el7_0.x86_64.rpm | 7.4 MB 00:00:00(8/9): mariadb-test-5.5.37-1.el7_0.x86_64.rpm | 7.9 MB 00:00:00(9/9): perl-DBD-MySQL-4.023-5.el7.x86_64.rpm | 140 kB 00:00:00----------------------------------------------------------------------------------------------------------Total 36 MB/s| 40 MB 00:00:01Running transaction checkRunning transactiontestTransactiontestsucceededRunning transactionInstalling : 1:mariadb-libs-5.5.37-1.el7_0.x86_64 1/9Installing : 1:mariadb-5.5.37-1.el7_0.x86_64 2/9Installing : perl-DBD-MySQL-4.023-5.el7.x86_64 3/9Installing : 1:mariadb-server-5.5.37-1.el7_0.x86_64 4/9Installing : 1:mariadb-devel-5.5.37-1.el7_0.x86_64 5/9Installing : 1:mariadb-embedded-5.5.37-1.el7_0.x86_64 6/9Installing : 1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_64 7/9Installing : 1:mariadb-test-5.5.37-1.el7_0.x86_64 8/9Installing : 1:mariadb-bench-5.5.37-1.el7_0.x86_64 9/9Verifying : 1:mariadb-test-5.5.37-1.el7_0.x86_64 1/9Verifying : 1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_64 2/9Verifying : 1:mariadb-embedded-5.5.37-1.el7_0.x86_64 3/9Verifying : 1:mariadb-libs-5.5.37-1.el7_0.x86_64 4/9Verifying : 1:mariadb-bench-5.5.37-1.el7_0.x86_64 5/9Verifying : 1:mariadb-5.5.37-1.el7_0.x86_64 6/9Verifying : 1:mariadb-server-5.5.37-1.el7_0.x86_64 7/9Verifying : perl-DBD-MySQL-4.023-5.el7.x86_64 8/9Verifying : 1:mariadb-devel-5.5.37-1.el7_0.x86_64 9/9Installed:mariadb.x86_64 1:5.5.37-1.el7_0 mariadb-bench.x86_64 1:5.5.37-1.el7_0mariadb-devel.x86_64 1:5.5.37-1.el7_0 mariadb-embedded.x86_64 1:5.5.37-1.el7_0mariadb-embedded-devel.x86_64 1:5.5.37-1.el7_0 mariadb-libs.x86_64 1:5.5.37-1.el7_0mariadb-server.x86_64 1:5.5.37-1.el7_0 mariadb-test.x86_64 1:5.5.37-1.el7_0Dependency Installed:perl-DBD-MySQL.x86_64 0:4.023-5.el7Complete![root@localhost ~]# systemctl start mariadb.service[root@localhost ~]# systemctl enable mariadb.serviceln-s'/usr/lib/systemd/system/mariadb.service''/etc/systemd/system/multi-user.target.wants/mariadb.service'[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connectionidis 2Server version: 5.5.37-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type'help;'or'\h'forhelp. Type'\c'toclearthe current input statement.MariaDB [(none)]>logout->exit->-> ;ERROR 1064 (42000): You have an errorinyour SQL syntax; check the manual that corresponds to your MariaDB server versionforthe right syntax to use near 'logoutexit' at line 1MariaDB [(none)]>exitBye[root@localhost ~]# systemctl enable mariadb.service[root@localhost ~]# mysqlWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connectionidis 3Server version: 5.5.37-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type'help;'or'\h'forhelp. Type'\c'toclearthe current input statement.MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema ||test|+--------------------+rowsinset(0.00 sec)MariaDB [(none)]> usetestDatabase changedMariaDB [test]> show tables;Emptyset(0.00 sec)MariaDB [test]>exitBye[root@localhost ~]# mysql_secure_installation/usr/bin/mysql_secure_installation: line 379: find_mysql_client:commandnot foundNOTE: 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 currentpasswordforthe root user. If you've just installed MariaDB, andyou haven'tsetthe root password yet, the password will be blank,so you should just press enter here.ERROR 1045 (28000): Access deniedforuser'root'@'localhost'(using password: YES)Enter current passwordforroot (enterfornone):OK, successfully used password, moving on...Setting the root password ensures that nobody can log into the MariaDBroot user without the proper authorisation.Set root password? [Y/n] yNew 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 createdforthem. This is intended onlyfortesting, and tomakethe installationgo a bit smoother. You should remove them before moving into aproduction environment.Remove anonymoususers? [Y/n] y... Success!Normally, root should only be allowed to connect from'localhost'. Thisensures 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 onlyfortesting, and should be removedbefore moving into a production environment.Removetestdatabase and access to it? [Y/n] y- Droppingtestdatabase...... Success!- Removing privileges ontestdatabase...... Success!Reloading the privilege tables will ensure that all changes made so farwill take effect immediately.Reload privilege tables now? [Y/n] y... Success!Cleaning up...Alldone! If you've completed all of the above steps, your MariaDBinstallation should now be secure.Thanksforusing MariaDB![root@localhost ~]# mysql -uroot -pEnter password:Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connectionidis 15Server version: 5.5.37-MariaDB MariaDB ServerCopyright (c) 2000, 2014, Oracle, Monty Program Ab and others.Type'help;'or'\h'forhelp. Type'\c'toclearthe current input statement.MariaDB [(none)]> show databases;+--------------------+| Database |+--------------------+| information_schema || mysql || performance_schema || zbphp.com |+--------------------+rowsinset(0.00 sec)MariaDB [(none)]>
以上就是CentOS 7系统下安装 MariaDB数据库的详细教程的全部内容,希望对大家的学习有所帮助。
您可能感兴趣的文章
声明:本文来自互联网或用户投稿,该文观点仅代表作者本人,不代表本站立场。文章及其配图仅供学习和交流之用,版权归原作者所有,如有内容侵权或者其他违规问题,请联系本站处理。








