centos7 安装 mariadb 的正确命令
分类:CentOS教程 阅读:99710 次
使用的是linode的centos7系统,安装mysql发现已经默认的是mariadb。
但是不管是使用linode官网说明还是百度搜索到的的根本安装方法无法安装成功。
总是提示这一句:
ERROR2002(HY000):Can'tconnecttolocalMySQLserverthroughsocket'/var/lib/mysql/mysql.sock'(2)
最后通过google 搜索 install mariadb on centos 7得到了安装的关键一步。
现在安装成功,特此备注一下整个安装过程:
- mysql:[root@localhost~]#yum-yinstallmariadb*
- Loadedplugins:fastestmirror
- Loadingmirrorspeedsfromcachedhostfile
- *base:mirrors.linode.com
- *extras:mirrors.linode.com
- *updates:mirrors.linode.com
- ResolvingDependencies
- -->Runningtransactioncheck
- --->Packagemariadb.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-bench.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-devel.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-embedded.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-embedded-devel.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-libs.x86_641:5.5.37-1.el7_0willbeinstalled
- --->Packagemariadb-server.x86_641:5.5.37-1.el7_0willbeinstalled
- -->ProcessingDependency:perl-DBD-MySQLforpackage:1:mariadb-server-5.5.37-1.el7_0.x86_64
- --->Packagemariadb-test.x86_641:5.5.37-1.el7_0willbeinstalled
- -->Runningtransactioncheck
- --->Packageperl-DBD-MySQL.x86_640:4.023-5.el7willbeinstalled
- -->FinishedDependencyResolution
- DependenciesResolved
- ==========================================================================================================
- PackageArchVersionRepositorySize
- ==========================================================================================================
- Installing:
- mariadbx86_641:5.5.37-1.el7_0updates8.9M
- mariadb-benchx86_641:5.5.37-1.el7_0updates385k
- mariadb-develx86_641:5.5.37-1.el7_0updates744k
- mariadb-embeddedx86_641:5.5.37-1.el7_0updates3.6M
- mariadb-embedded-develx86_641:5.5.37-1.el7_0updates7.4M
- mariadb-libsx86_641:5.5.37-1.el7_0updates752k
- mariadb-serverx86_641:5.5.37-1.el7_0updates11M
- mariadb-testx86_641:5.5.37-1.el7_0updates7.9M
- Installingfordependencies:
- perl-DBD-MySQLx86_644.023-5.el7base140k
- TransactionSummary
- ==========================================================================================================
- Install8Packages(+1Dependentpackage)
- Totaldownloadsize:40M
- Installedsize:279M
- Downloadingpackages:
- (1/9):mariadb-bench-5.5.37-1.el7_0.x86_64.rpm|385kB00:00:00
- (2/9):mariadb-devel-5.5.37-1.el7_0.x86_64.rpm|744kB00:00:00
- (3/9):mariadb-embedded-5.5.37-1.el7_0.x86_64.rpm|3.6MB00:00:00
- (4/9):mariadb-5.5.37-1.el7_0.x86_64.rpm|8.9MB00:00:00
- (5/9):mariadb-libs-5.5.37-1.el7_0.x86_64.rpm|752kB00:00:00
- (6/9):mariadb-server-5.5.37-1.el7_0.x86_64.rpm|11MB00:00:00
- (7/9):mariadb-embedded-devel-5.5.37-1.el7_0.x86_64.rpm|7.4MB00:00:00
- (8/9):mariadb-test-5.5.37-1.el7_0.x86_64.rpm|7.9MB00:00:00
- (9/9):perl-DBD-MySQL-4.023-5.el7.x86_64.rpm|140kB00:00:00
- ----------------------------------------------------------------------------------------------------------
- Total36MB/s|40MB00:00:01
- Runningtransactioncheck
- Runningtransactiontest
- Transactiontestsucceeded
- Runningtransaction
- Installing:1:mariadb-libs-5.5.37-1.el7_0.x86_641/9
- Installing:1:mariadb-5.5.37-1.el7_0.x86_642/9
- Installing:perl-DBD-MySQL-4.023-5.el7.x86_643/9
- Installing:1:mariadb-server-5.5.37-1.el7_0.x86_644/9
- Installing:1:mariadb-devel-5.5.37-1.el7_0.x86_645/9
- Installing:1:mariadb-embedded-5.5.37-1.el7_0.x86_646/9
- Installing:1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_647/9
- Installing:1:mariadb-test-5.5.37-1.el7_0.x86_648/9
- Installing:1:mariadb-bench-5.5.37-1.el7_0.x86_649/9
- Verifying:1:mariadb-test-5.5.37-1.el7_0.x86_641/9
- Verifying:1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_642/9
- Verifying:1:mariadb-embedded-5.5.37-1.el7_0.x86_643/9
- Verifying:1:mariadb-libs-5.5.37-1.el7_0.x86_644/9
- Verifying:1:mariadb-bench-5.5.37-1.el7_0.x86_645/9
- Verifying:1:mariadb-5.5.37-1.el7_0.x86_646/9
- Verifying:1:mariadb-server-5.5.37-1.el7_0.x86_647/9
- Verifying:perl-DBD-MySQL-4.023-5.el7.x86_648/9
- Verifying:1:mariadb-devel-5.5.37-1.el7_0.x86_649/9
- Installed:
- mariadb.x86_641:5.5.37-1.el7_0mariadb-bench.x86_641:5.5.37-1.el7_0
- mariadb-devel.x86_641:5.5.37-1.el7_0mariadb-embedded.x86_641:5.5.37-1.el7_0
- mariadb-embedded-devel.x86_641:5.5.37-1.el7_0mariadb-libs.x86_641:5.5.37-1.el7_0
- mariadb-server.x86_641:5.5.37-1.el7_0mariadb-test.x86_641:5.5.37-1.el7_0
- DependencyInstalled:
- perl-DBD-MySQL.x86_640:4.023-5.el7
- Complete!
- [root@localhost~]#systemctlstartmariadb.service
- [root@localhost~]#systemctlenablemariadb.service
- ln-s'/usr/lib/systemd/system/mariadb.service''/etc/systemd/system/multi-user.target.wants/mariadb.servi
- ce'
- [root@localhost~]#mysql
- WelcometotheMariaDBmonitor.Commandsendwith;or\g.
- YourMariaDBconnectionidis2
- Serverversion:5.5.37-MariaDBMariaDBServer
- Copyright(c)2000,2014,Oracle,MontyProgramAbandothers.
- Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
- MariaDB[(none)]>logout
- ->exit
- ->
- ->;
- ERROR1064(42000):YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMariaD
- Bserverversionfortherightsyntaxtousenear'logout
- exit'atline1
- MariaDB[(none)]>exit
- Bye
- [root@localhost~]#systemctlenablemariadb.service
- [root@localhost~]#mysql
- WelcometotheMariaDBmonitor.Commandsendwith;or\g.
- YourMariaDBconnectionidis3
- Serverversion:5.5.37-MariaDBMariaDBServer
- Copyright(c)2000,2014,Oracle,MontyProgramAbandothers.
- Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
- MariaDB[(none)]>showdatabases;
- +--------------------+
- |Database|
- +--------------------+
- |information_schema|
- |mysql|
- |performance_schema|
- |test|
- +--------------------+
- 4rowsinset(0.00sec)
- MariaDB[(none)]>usetest
- Databasechanged
- MariaDB[test]>showtables;
- Emptyset(0.00sec)
- MariaDB[test]>exit
- Bye
- [root@localhost~]#mysql_secure_installation
- /usr/bin/mysql_secure_installation:line379:find_mysql_client:commandnotfound
- NOTE:RUNNINGALLPARTSOFTHISSCRIPTISRECOMMENDEDFORALLMariaDB
- SERVERSINPRODUCTIONUSE!PLEASEREADEACHSTEPCAREFULLY!
- InordertologintoMariaDBtosecureit,we'llneedthecurrent
- passwordfortherootuser.Ifyou'vejustinstalledMariaDB,and
- youhaven'tsettherootpasswordyet,thepasswordwillbeblank,
- soyoushouldjustpressenterhere.
- ERROR1045(28000):Accessdeniedforuser'root'@'localhost'(usingpassword:YES)
- Entercurrentpasswordforroot(enterfornone):
- OK,successfullyusedpassword,movingon...
- SettingtherootpasswordensuresthatnobodycanlogintotheMariaDB
- rootuserwithouttheproperauthorisation.
- Setrootpassword?[Y/n]y
- Newpassword:
- Re-enternewpassword:
- Passwordupdatedsuccessfully!
- Reloadingprivilegetables..
- ...Success!
- Bydefault,aMariaDBinstallationhasananonymoususer,allowinganyone
- tologintoMariaDBwithouthavingtohaveauseraccountcreatedfor
- them.Thisisintendedonlyfortesting,andtomaketheinstallation
- goabitsmoother.Youshouldremovethembeforemovingintoa
- productionenvironment.
- Removeanonymoususers?[Y/n]y
- ...Success!
- Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.This
- ensuresthatsomeonecannotguessattherootpasswordfromthenetwork.
- Disallowrootloginremotely?[Y/n]y
- ...Success!
- Bydefault,MariaDBcomeswithadatabasenamed'test'thatanyonecan
- access.Thisisalsointendedonlyfortesting,andshouldberemoved
- beforemovingintoaproductionenvironment.
- Removetestdatabaseandaccesstoit?[Y/n]y
- -Droppingtestdatabase...
- ...Success!
- -Removingprivilegesontestdatabase...
- ...Success!
- Reloadingtheprivilegetableswillensurethatallchangesmadesofar
- willtakeeffectimmediately.
- Reloadprivilegetablesnow?[Y/n]y
- ...Success!
- Cleaningup...
- Alldone!Ifyou'vecompletedalloftheabovesteps,yourMariaDB
- installationshouldnowbesecure.
- ThanksforusingMariaDB!
- [root@localhost~]#mysql-uroot-p
- Enterpassword:
- WelcometotheMariaDBmonitor.Commandsendwith;or\g.
- YourMariaDBconnectionidis15
- Serverversion:5.5.37-MariaDBMariaDBServer
- Copyright(c)2000,2014,Oracle,MontyProgramAbandothers.
- Type'help;'or'\h'forhelp.Type'\c'toclearthecurrentinputstatement.
- MariaDB[(none)]>showdatabases;
- +--------------------+
- |Database|
- +--------------------+
- |information_schema|
- |mysql|
- |performance_schema|
- |zbphp.com|
- +--------------------+
- 4rowsinset(0.00sec)
- MariaDB[(none)]>
文章 by default7#zbphp.com
热门推荐
- CentOS 7.1PXE网络自动化安装
- CentOS6.4 安装jenkins
- CentOS6.2安装配置 Mongodb3.0.4
- CentOS 6使用openssl搭建根CA
- CentOS 6.4安装配置squid
- CentOS 安装 Maven
- CentOS 安装SVN客户端
- centos 7 安装gamit和GMT
- CentOS安装配置openvpn使用ldap进行身份认证
- CentOS安装配置openvpn使用ldap进行身份认证
- 阿里云Centos6.5安装配置docker
- CentOS 6.6 x64搭建基于用户密码认证的openvpn
- CentOS 6.6 x64简单搭建openvpn
- CentOS 5系统安装saltstack安装
- centos 6.4配置samba+ldap认证
- CentOS 6.4安装配置ldap
- CentOS下php的安装与配置[源码安装]
- CentOS配置snmp
- CentOS 6.5编译Apache2.4.12,MySQL5.6.21,PHP5.6
- CentOS记录用户行为轨迹