Ubuntu下MySQL如何安装

数据库   2024年01月14日 21:12  

这篇文章主要介绍了Ubuntu下MySQL如何安装的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇Ubuntu下MySQL如何安装文章都会有所收获,下面我们一起来看看吧。

1. 安装sudoapt-getupdatesudoapt-getinstall2. 数据库初始化sudo交互如下:SecuringtheMySQLserverdeployment.ConnectingtoMySQLusingablankpassword.VALIDATEPASSWORDPLUGINcanbeusedtotestpasswordsandimprovesecurity.Itchecksthestrengthofpasswordandallowstheuserstosetonlythosepasswordswhicharesecureenough.WouldyouliketosetupVALIDATEPASSWORDplugin?Pressy|YforYes,anyotherkeyforNo:yTherearethreelevelsofpasswordvalidationpolicy:LOWLength>=8MEDIUMLength>=8,numeric,mixedcase,andspecialcharactersSTRONGLength>=8,numeric,mixedcase,specialcharactersanddictionaryfilePleaseenter0=LOW,1=MEDIUMand2=STRONG:2<=====注意这里一定要选2,STRONGPleasesetthepasswordforroothere.Newpassword:Re-enternewpassword:Estimatedstrengthofthepassword:100Doyouwishtocontinuewiththepasswordprovided?(Pressy|YforYes,anyotherkeyforNo):yBydefault,aMySQLinstallationhasananonymoususer,allowinganyonetologintoMySQLwithouthavingtohaveauseraccountcreatedforthem.Thisisintendedonlyfortesting,andtomaketheinstallationgoabitsmoother.Youshouldremovethembeforemovingintoaproductionenvironment.Removeanonymoususers?(Pressy|YforYes,anyotherkeyforNo):ySuccess.Normally,rootshouldonlybeallowedtoconnectfrom'localhost'.Thisensuresthatsomeonecannotguessattherootpasswordfromthenetwork.Disallowrootloginremotely?(Pressy|YforYes,anyotherkeyforNo):ySuccess.Bydefault,MySQLcomeswithadatabasenamed'test'thatanyonecanaccess.Thisisalsointendedonlyfortesting,andshouldberemovedbeforemovingintoaproductionenvironment.Removetestdatabaseandaccesstoit?(Pressy|YforYes,anyotherkeyforNo):y-Droppingtestdatabase...Success.-Removingprivilegesontestdatabase...Success.Reloadingtheprivilegetableswillensurethatallchangesmadesofarwilltakeeffectimmediately.Reloadprivilegetablesnow?(Pressy|YforYes,anyotherkeyforNo):ySuccess.Alldone!3. 不使用sudo访问MySQL($ -uroot -p)要求对MySQL设置最高密码强度Pleaseenter0=LOW,1=MEDIUMand2=4. 启动MySQLsudosystemctlstartmysql.servicesudosystemctlenablemysql.servicesudo5. 权限设定(可选)>usemysql;>selectUser,Host,pluginfromuser;+------------------+-----------+-----------------------+|User|Host|plugin|+------------------+-----------+-----------------------+|root|localhost|auth_socket<--这里||.session|localhost|_native_password||.sys|localhost|_native_password||debian-sys-maint|localhost|_native_password|+------------------+-----------+-----------------------+>updateusersetplugin='_native_password'whereUser='root'andHost='localhost';>GRANTALLPRIVILEGESON*.*TO'root'@'localhost';>flushprivileges;6. 修改字符集为UTF-8>showvariableslike'char%';>showvariableslike'collation%';sudovim/etc//conf.d/.cnf[]default-character-set=utf8sudovim/etc//mysql.conf.d/mysqld.cnf[mysqld]collation-server=utf8_general_cicharacter-set-server=utf8sudo7. 查看运行状态sudosystemctlstatusmysql.servicesudolsof-i:3306netstat-ntpl|grep

关于“Ubuntu下MySQL如何安装”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“Ubuntu下MySQL如何安装”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注行业资讯频道。

域名注册
购买VPS主机

您或许对下面这些文章有兴趣:                    本月吐槽辛苦排行榜

看贴要回贴有N种理由!看帖不回贴的后果你懂得的!


评论内容 (*必填):
(Ctrl + Enter提交)   

部落快速搜索栏

各类专题梳理

网站导航栏

X
返回顶部