[{"data":1,"prerenderedAt":1109},["ShallowReactive",2],{"post-\u002Fblog\u002F2020-05-12-centos-mysql80":3,"surround-\u002Fblog\u002F2020-05-12-centos-mysql80":1102},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"date":10,"tags":11,"cover":16,"source":17,"body":18,"_type":1096,"_id":1097,"_source":1098,"_file":1099,"_stem":1100,"_extension":1101},"\u002Fblog\u002F2020-05-12-centos-mysql80","blog",false,"","Centos 7.3 安装 MySQL 8.0","完整的 CentOS 7.3 安装 MySQL 8.0 教程，包括准备工作、安装配置、密码策略修改、远程访问开启及字符编码设置。","2020-05-12",[12,13,14,15],"简书","历史归档","MySQL","Linux","https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-c5cda4af38ff1060.png","https:\u002F\u002Fwww.jianshu.com\u002Fp\u002Fdb03c0959506",{"type":19,"children":20,"toc":1092},"root",[21,29,39,90,105,115,124,173,181,190,215,224,247,260,265,273,297,305,335,340,348,356,364,389,397,420,435,454,479,486,495,651,656,665,696,703,753,760,765,788,796,890,895,918,927,978,987,1016,1023,1028,1061,1065,1086],{"type":22,"tag":23,"props":24,"children":26},"element","h2",{"id":25},"准备工作",[27],{"type":28,"value":25},"text",{"type":22,"tag":30,"props":31,"children":32},"ol",{},[33],{"type":22,"tag":34,"props":35,"children":36},"li",{},[37],{"type":28,"value":38},"查看是否有安装过 mysql",{"type":22,"tag":40,"props":41,"children":45},"pre",{"className":42,"code":43,"language":44,"meta":7,"style":7},"language-shell shiki shiki-themes github-light github-dark","rpm -qa | grep -i mysql\n","shell",[46],{"type":22,"tag":47,"props":48,"children":49},"code",{"__ignoreMap":7},[50],{"type":22,"tag":51,"props":52,"children":55},"span",{"class":53,"line":54},"line",1,[56,62,68,74,79,84],{"type":22,"tag":51,"props":57,"children":59},{"style":58},"--shiki-default:#6F42C1;--shiki-dark:#B392F0",[60],{"type":28,"value":61},"rpm",{"type":22,"tag":51,"props":63,"children":65},{"style":64},"--shiki-default:#005CC5;--shiki-dark:#79B8FF",[66],{"type":28,"value":67}," -qa",{"type":22,"tag":51,"props":69,"children":71},{"style":70},"--shiki-default:#D73A49;--shiki-dark:#F97583",[72],{"type":28,"value":73}," |",{"type":22,"tag":51,"props":75,"children":76},{"style":58},[77],{"type":28,"value":78}," grep",{"type":22,"tag":51,"props":80,"children":81},{"style":64},[82],{"type":28,"value":83}," -i",{"type":22,"tag":51,"props":85,"children":87},{"style":86},"--shiki-default:#032F62;--shiki-dark:#9ECBFF",[88],{"type":28,"value":89}," mysql\n",{"type":22,"tag":30,"props":91,"children":93},{"start":92},2,[94],{"type":22,"tag":34,"props":95,"children":96},{},[97,99],{"type":28,"value":98},"删除 MySQL ",{"type":22,"tag":47,"props":100,"children":102},{"className":101},[],[103],{"type":28,"value":104},"yum -y remove MySQL-*",{"type":22,"tag":106,"props":107,"children":108},"blockquote",{},[109],{"type":22,"tag":110,"props":111,"children":112},"p",{},[113],{"type":28,"value":114},"一般用rpm -e 的命令删除mysql,这样表面上删除了mysql,可是mysql的一些残余程序仍然存在,并且通过第一步的方式也查找不到残余,而yum命令比较强大,可以完全删除mysql.(用rpm删除后再次安装的时候会提示已经安装了,这就是rpm没删除干净的原因)",{"type":22,"tag":30,"props":116,"children":118},{"start":117},3,[119],{"type":22,"tag":34,"props":120,"children":121},{},[122],{"type":28,"value":123},"把所有出现的目录统统删除",{"type":22,"tag":40,"props":125,"children":127},{"className":42,"code":126,"language":44,"meta":7,"style":7},"find \u002F -name mysql | xargs rm -rf\n",[128],{"type":22,"tag":47,"props":129,"children":130},{"__ignoreMap":7},[131],{"type":22,"tag":51,"props":132,"children":133},{"class":53,"line":54},[134,139,144,149,154,158,163,168],{"type":22,"tag":51,"props":135,"children":136},{"style":58},[137],{"type":28,"value":138},"find",{"type":22,"tag":51,"props":140,"children":141},{"style":86},[142],{"type":28,"value":143}," \u002F",{"type":22,"tag":51,"props":145,"children":146},{"style":64},[147],{"type":28,"value":148}," -name",{"type":22,"tag":51,"props":150,"children":151},{"style":86},[152],{"type":28,"value":153}," mysql",{"type":22,"tag":51,"props":155,"children":156},{"style":70},[157],{"type":28,"value":73},{"type":22,"tag":51,"props":159,"children":160},{"style":58},[161],{"type":28,"value":162}," xargs",{"type":22,"tag":51,"props":164,"children":165},{"style":86},[166],{"type":28,"value":167}," rm",{"type":22,"tag":51,"props":169,"children":170},{"style":64},[171],{"type":28,"value":172}," -rf\n",{"type":22,"tag":106,"props":174,"children":175},{},[176],{"type":22,"tag":110,"props":177,"children":178},{},[179],{"type":28,"value":180},"查找mysql的一些目录，把所有出现的目录删除，可以使用rm -rf 路径，删除时请注意，一旦删除无法恢复。",{"type":22,"tag":30,"props":182,"children":184},{"start":183},4,[185],{"type":22,"tag":34,"props":186,"children":187},{},[188],{"type":28,"value":189},"删除配置文件",{"type":22,"tag":40,"props":191,"children":193},{"className":42,"code":192,"language":44,"meta":7,"style":7},"rm -rf \u002Fetc\u002Fmy.cnf\n",[194],{"type":22,"tag":47,"props":195,"children":196},{"__ignoreMap":7},[197],{"type":22,"tag":51,"props":198,"children":199},{"class":53,"line":54},[200,205,210],{"type":22,"tag":51,"props":201,"children":202},{"style":58},[203],{"type":28,"value":204},"rm",{"type":22,"tag":51,"props":206,"children":207},{"style":64},[208],{"type":28,"value":209}," -rf",{"type":22,"tag":51,"props":211,"children":212},{"style":86},[213],{"type":28,"value":214}," \u002Fetc\u002Fmy.cnf\n",{"type":22,"tag":30,"props":216,"children":218},{"start":217},5,[219],{"type":22,"tag":34,"props":220,"children":221},{},[222],{"type":28,"value":223},"删除mysql的默认密码",{"type":22,"tag":40,"props":225,"children":227},{"className":42,"code":226,"language":44,"meta":7,"style":7},"rm -rf \u002Froot\u002F.mysql_sercret\n",[228],{"type":22,"tag":47,"props":229,"children":230},{"__ignoreMap":7},[231],{"type":22,"tag":51,"props":232,"children":233},{"class":53,"line":54},[234,238,242],{"type":22,"tag":51,"props":235,"children":236},{"style":58},[237],{"type":28,"value":204},{"type":22,"tag":51,"props":239,"children":240},{"style":64},[241],{"type":28,"value":209},{"type":22,"tag":51,"props":243,"children":244},{"style":86},[245],{"type":28,"value":246}," \u002Froot\u002F.mysql_sercret\n",{"type":22,"tag":110,"props":248,"children":249},{},[250,252,258],{"type":28,"value":251},"五步完成之后，这样mysql就全部删除干净了，若没安装过 ",{"type":22,"tag":47,"props":253,"children":255},{"className":254},[],[256],{"type":28,"value":257},"mysql",{"type":28,"value":259}," 可忽略以上步骤",{"type":22,"tag":23,"props":261,"children":263},{"id":262},"开始安装",[264],{"type":28,"value":262},{"type":22,"tag":30,"props":266,"children":267},{},[268],{"type":22,"tag":34,"props":269,"children":270},{},[271],{"type":28,"value":272},"配置Mysql 8.0安装源",{"type":22,"tag":40,"props":274,"children":276},{"className":42,"code":275,"language":44,"meta":7,"style":7},"rpm -Uvh https:\u002F\u002Fdev.mysql.com\u002Fget\u002Fmysql80-community-release-el7-3.noarch.rpm\n",[277],{"type":22,"tag":47,"props":278,"children":279},{"__ignoreMap":7},[280],{"type":22,"tag":51,"props":281,"children":282},{"class":53,"line":54},[283,287,292],{"type":22,"tag":51,"props":284,"children":285},{"style":58},[286],{"type":28,"value":61},{"type":22,"tag":51,"props":288,"children":289},{"style":64},[290],{"type":28,"value":291}," -Uvh",{"type":22,"tag":51,"props":293,"children":294},{"style":86},[295],{"type":28,"value":296}," https:\u002F\u002Fdev.mysql.com\u002Fget\u002Fmysql80-community-release-el7-3.noarch.rpm\n",{"type":22,"tag":30,"props":298,"children":299},{"start":92},[300],{"type":22,"tag":34,"props":301,"children":302},{},[303],{"type":28,"value":304},"安装Mysql 8.0",{"type":22,"tag":40,"props":306,"children":308},{"className":42,"code":307,"language":44,"meta":7,"style":7},"yum --enablerepo=mysql80-community install mysql-community-server\n",[309],{"type":22,"tag":47,"props":310,"children":311},{"__ignoreMap":7},[312],{"type":22,"tag":51,"props":313,"children":314},{"class":53,"line":54},[315,320,325,330],{"type":22,"tag":51,"props":316,"children":317},{"style":58},[318],{"type":28,"value":319},"yum",{"type":22,"tag":51,"props":321,"children":322},{"style":64},[323],{"type":28,"value":324}," --enablerepo=mysql80-community",{"type":22,"tag":51,"props":326,"children":327},{"style":86},[328],{"type":28,"value":329}," install",{"type":22,"tag":51,"props":331,"children":332},{"style":86},[333],{"type":28,"value":334}," mysql-community-server\n",{"type":22,"tag":110,"props":336,"children":337},{},[338],{"type":28,"value":339},"提示下载插件选择：y",{"type":22,"tag":110,"props":341,"children":342},{},[343],{"type":22,"tag":344,"props":345,"children":347},"img",{"alt":7,"src":346},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-c5cda4af38ff1060.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F1200\u002Fformat\u002Fwebp",[],{"type":22,"tag":106,"props":349,"children":350},{},[351],{"type":22,"tag":110,"props":352,"children":353},{},[354],{"type":28,"value":355},"看到complet(完毕)就是安装完啦",{"type":22,"tag":30,"props":357,"children":358},{"start":117},[359],{"type":22,"tag":34,"props":360,"children":361},{},[362],{"type":28,"value":363},"启动 MySQL 服务",{"type":22,"tag":40,"props":365,"children":367},{"className":42,"code":366,"language":44,"meta":7,"style":7},"systemctl start mysqld\n",[368],{"type":22,"tag":47,"props":369,"children":370},{"__ignoreMap":7},[371],{"type":22,"tag":51,"props":372,"children":373},{"class":53,"line":54},[374,379,384],{"type":22,"tag":51,"props":375,"children":376},{"style":58},[377],{"type":28,"value":378},"systemctl",{"type":22,"tag":51,"props":380,"children":381},{"style":86},[382],{"type":28,"value":383}," start",{"type":22,"tag":51,"props":385,"children":386},{"style":86},[387],{"type":28,"value":388}," mysqld\n",{"type":22,"tag":30,"props":390,"children":391},{"start":183},[392],{"type":22,"tag":34,"props":393,"children":394},{},[395],{"type":28,"value":396},"查看mysql服务运行状态",{"type":22,"tag":40,"props":398,"children":400},{"className":42,"code":399,"language":44,"meta":7,"style":7},"systemctl status mysqld\n",[401],{"type":22,"tag":47,"props":402,"children":403},{"__ignoreMap":7},[404],{"type":22,"tag":51,"props":405,"children":406},{"class":53,"line":54},[407,411,416],{"type":22,"tag":51,"props":408,"children":409},{"style":58},[410],{"type":28,"value":378},{"type":22,"tag":51,"props":412,"children":413},{"style":86},[414],{"type":28,"value":415}," status",{"type":22,"tag":51,"props":417,"children":418},{"style":86},[419],{"type":28,"value":388},{"type":22,"tag":30,"props":421,"children":422},{"start":217},[423],{"type":22,"tag":34,"props":424,"children":425},{},[426,428,433],{"type":28,"value":427},"查看 ",{"type":22,"tag":47,"props":429,"children":431},{"className":430},[],[432],{"type":28,"value":19},{"type":28,"value":434}," 临时密码",{"type":22,"tag":110,"props":436,"children":437},{},[438,440,445,447,452],{"type":28,"value":439},"安装完 ",{"type":22,"tag":47,"props":441,"children":443},{"className":442},[],[444],{"type":28,"value":14},{"type":28,"value":446}," 之后，会生成一个临时的密码让 ",{"type":22,"tag":47,"props":448,"children":450},{"className":449},[],[451],{"type":28,"value":19},{"type":28,"value":453}," 用户登录",{"type":22,"tag":40,"props":455,"children":457},{"className":42,"code":456,"language":44,"meta":7,"style":7},"grep \"A temporary password\" \u002Fvar\u002Flog\u002Fmysqld.log\n",[458],{"type":22,"tag":47,"props":459,"children":460},{"__ignoreMap":7},[461],{"type":22,"tag":51,"props":462,"children":463},{"class":53,"line":54},[464,469,474],{"type":22,"tag":51,"props":465,"children":466},{"style":58},[467],{"type":28,"value":468},"grep",{"type":22,"tag":51,"props":470,"children":471},{"style":86},[472],{"type":28,"value":473}," \"A temporary password\"",{"type":22,"tag":51,"props":475,"children":476},{"style":86},[477],{"type":28,"value":478}," \u002Fvar\u002Flog\u002Fmysqld.log\n",{"type":22,"tag":110,"props":480,"children":481},{},[482],{"type":22,"tag":344,"props":483,"children":485},{"alt":7,"src":484},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-d7cf1730432d34b3.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F1161\u002Fformat\u002Fwebp",[],{"type":22,"tag":30,"props":487,"children":489},{"start":488},6,[490],{"type":22,"tag":34,"props":491,"children":492},{},[493],{"type":28,"value":494},"更改临时密码",{"type":22,"tag":40,"props":496,"children":500},{"className":497,"code":498,"language":499,"meta":7,"style":7},"language-bash shiki shiki-themes github-light github-dark","输入：mysql -uroot -p\n在Enter password：后面输入临时密码\n登录成功\n输入：ALTER USER 'root'@'localhost' IDENTIFIED BY 'new password';\n会提示：ERROR 1819 (HY000): Your password does not satisfy the current policy requirements(密码不符合当前策略)\n方案1: 设置符合策略的密码(大小写字母+数据+符号)\n方案2: 密码策略改简单一点\n","bash",[501],{"type":22,"tag":47,"props":502,"children":503},{"__ignoreMap":7},[504,522,535,543,582,610,637],{"type":22,"tag":51,"props":505,"children":506},{"class":53,"line":54},[507,512,517],{"type":22,"tag":51,"props":508,"children":509},{"style":58},[510],{"type":28,"value":511},"输入：mysql",{"type":22,"tag":51,"props":513,"children":514},{"style":64},[515],{"type":28,"value":516}," -uroot",{"type":22,"tag":51,"props":518,"children":519},{"style":64},[520],{"type":28,"value":521}," -p\n",{"type":22,"tag":51,"props":523,"children":524},{"class":53,"line":92},[525,530],{"type":22,"tag":51,"props":526,"children":527},{"style":58},[528],{"type":28,"value":529},"在Enter",{"type":22,"tag":51,"props":531,"children":532},{"style":86},[533],{"type":28,"value":534}," password：后面输入临时密码\n",{"type":22,"tag":51,"props":536,"children":537},{"class":53,"line":117},[538],{"type":22,"tag":51,"props":539,"children":540},{"style":58},[541],{"type":28,"value":542},"登录成功\n",{"type":22,"tag":51,"props":544,"children":545},{"class":53,"line":183},[546,551,556,561,566,571,576],{"type":22,"tag":51,"props":547,"children":548},{"style":58},[549],{"type":28,"value":550},"输入：ALTER",{"type":22,"tag":51,"props":552,"children":553},{"style":86},[554],{"type":28,"value":555}," USER",{"type":22,"tag":51,"props":557,"children":558},{"style":86},[559],{"type":28,"value":560}," 'root'@'localhost'",{"type":22,"tag":51,"props":562,"children":563},{"style":86},[564],{"type":28,"value":565}," IDENTIFIED",{"type":22,"tag":51,"props":567,"children":568},{"style":86},[569],{"type":28,"value":570}," BY",{"type":22,"tag":51,"props":572,"children":573},{"style":86},[574],{"type":28,"value":575}," 'new password'",{"type":22,"tag":51,"props":577,"children":579},{"style":578},"--shiki-default:#24292E;--shiki-dark:#E1E4E8",[580],{"type":28,"value":581},";\n",{"type":22,"tag":51,"props":583,"children":584},{"class":53,"line":217},[585,590,595,600,605],{"type":22,"tag":51,"props":586,"children":587},{"style":58},[588],{"type":28,"value":589},"会提示：ERROR",{"type":22,"tag":51,"props":591,"children":592},{"style":64},[593],{"type":28,"value":594}," 1819",{"type":22,"tag":51,"props":596,"children":597},{"style":578},[598],{"type":28,"value":599}," (HY000): Your password does not satisfy the current policy requirements(",{"type":22,"tag":51,"props":601,"children":602},{"style":58},[603],{"type":28,"value":604},"密码不符合当前策略",{"type":22,"tag":51,"props":606,"children":607},{"style":578},[608],{"type":28,"value":609},")\n",{"type":22,"tag":51,"props":611,"children":612},{"class":53,"line":488},[613,618,623,628,633],{"type":22,"tag":51,"props":614,"children":615},{"style":58},[616],{"type":28,"value":617},"方案1:",{"type":22,"tag":51,"props":619,"children":620},{"style":86},[621],{"type":28,"value":622}," 设置符合策略的密码",{"type":22,"tag":51,"props":624,"children":625},{"style":578},[626],{"type":28,"value":627},"(",{"type":22,"tag":51,"props":629,"children":630},{"style":58},[631],{"type":28,"value":632},"大小写字母+数据+符号",{"type":22,"tag":51,"props":634,"children":635},{"style":578},[636],{"type":28,"value":609},{"type":22,"tag":51,"props":638,"children":640},{"class":53,"line":639},7,[641,646],{"type":22,"tag":51,"props":642,"children":643},{"style":58},[644],{"type":28,"value":645},"方案2:",{"type":22,"tag":51,"props":647,"children":648},{"style":86},[649],{"type":28,"value":650}," 密码策略改简单一点\n",{"type":22,"tag":110,"props":652,"children":653},{},[654],{"type":28,"value":655},"方案2设置方式",{"type":22,"tag":657,"props":658,"children":659},"ul",{},[660],{"type":22,"tag":34,"props":661,"children":662},{},[663],{"type":28,"value":664},"查看当前密码策略",{"type":22,"tag":40,"props":666,"children":670},{"className":667,"code":668,"language":669,"meta":7,"style":7},"language-sql shiki shiki-themes github-light github-dark","SHOW VARIABLES LIKE 'validate_password.%';\n","sql",[671],{"type":22,"tag":47,"props":672,"children":673},{"__ignoreMap":7},[674],{"type":22,"tag":51,"props":675,"children":676},{"class":53,"line":54},[677,682,687,692],{"type":22,"tag":51,"props":678,"children":679},{"style":578},[680],{"type":28,"value":681},"SHOW VARIABLES ",{"type":22,"tag":51,"props":683,"children":684},{"style":70},[685],{"type":28,"value":686},"LIKE",{"type":22,"tag":51,"props":688,"children":689},{"style":86},[690],{"type":28,"value":691}," 'validate_password.%'",{"type":22,"tag":51,"props":693,"children":694},{"style":578},[695],{"type":28,"value":581},{"type":22,"tag":110,"props":697,"children":698},{},[699],{"type":22,"tag":344,"props":700,"children":702},{"alt":7,"src":701},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-7cbc7ebf577cd08b.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F923\u002Fformat\u002Fwebp",[],{"type":22,"tag":657,"props":704,"children":705},{},[706],{"type":22,"tag":34,"props":707,"children":708},{},[709,711,717,719,725,731,733,739,745,747],{"type":28,"value":710},"修改密码策略\n",{"type":22,"tag":47,"props":712,"children":714},{"className":713},[],[715],{"type":28,"value":716},"validate_password.length",{"type":28,"value":718}," 是密码的最小长度，默认是8，我们把它改成6\n输入： ",{"type":22,"tag":47,"props":720,"children":722},{"className":721},[],[723],{"type":28,"value":724},"set global validate_password.length=6;",{"type":22,"tag":47,"props":726,"children":728},{"className":727},[],[729],{"type":28,"value":730},"validate_password.policy",{"type":28,"value":732}," 验证密码的复杂程度，我们把它改成0\n输入： ",{"type":22,"tag":47,"props":734,"children":736},{"className":735},[],[737],{"type":28,"value":738},"set global validate_password.policy=0;",{"type":22,"tag":47,"props":740,"children":742},{"className":741},[],[743],{"type":28,"value":744},"validate_password.check_user_name",{"type":28,"value":746}," 用户名检查，用户名和密码不能相同，我们也把它关掉\n输入： ",{"type":22,"tag":47,"props":748,"children":750},{"className":749},[],[751],{"type":28,"value":752},"set global validate_password.check_user_name=off;",{"type":22,"tag":110,"props":754,"children":755},{},[756],{"type":22,"tag":344,"props":757,"children":759},{"alt":7,"src":758},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-0588efc96830223f.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F999\u002Fformat\u002Fwebp",[],{"type":22,"tag":110,"props":761,"children":762},{},[763],{"type":28,"value":764},"重启mysql服务使配置生效",{"type":22,"tag":40,"props":766,"children":768},{"className":42,"code":767,"language":44,"meta":7,"style":7},"systemctl restart mysqld\n",[769],{"type":22,"tag":47,"props":770,"children":771},{"__ignoreMap":7},[772],{"type":22,"tag":51,"props":773,"children":774},{"class":53,"line":54},[775,779,784],{"type":22,"tag":51,"props":776,"children":777},{"style":58},[778],{"type":28,"value":378},{"type":22,"tag":51,"props":780,"children":781},{"style":86},[782],{"type":28,"value":783}," restart",{"type":22,"tag":51,"props":785,"children":786},{"style":86},[787],{"type":28,"value":388},{"type":22,"tag":30,"props":789,"children":790},{"start":639},[791],{"type":22,"tag":34,"props":792,"children":793},{},[794],{"type":28,"value":795},"开启mysql的远程访问\n执行以下命令开启远程访问限制（注意：下面命令开启的IP是 192.168.0.1，如要开启所有的，用%代替IP）：",{"type":22,"tag":40,"props":797,"children":799},{"className":667,"code":798,"language":669,"meta":7,"style":7},"grant all privileges on *.* to 'root'@'192.168.0.1' identified by 'password' with grant option;\n",[800],{"type":22,"tag":47,"props":801,"children":802},{"__ignoreMap":7},[803],{"type":22,"tag":51,"props":804,"children":805},{"class":53,"line":54},[806,811,816,821,826,831,836,841,846,851,856,861,866,871,876,881,886],{"type":22,"tag":51,"props":807,"children":808},{"style":70},[809],{"type":28,"value":810},"grant",{"type":22,"tag":51,"props":812,"children":813},{"style":578},[814],{"type":28,"value":815}," all privileges ",{"type":22,"tag":51,"props":817,"children":818},{"style":70},[819],{"type":28,"value":820},"on",{"type":22,"tag":51,"props":822,"children":823},{"style":70},[824],{"type":28,"value":825}," *",{"type":22,"tag":51,"props":827,"children":828},{"style":578},[829],{"type":28,"value":830},".",{"type":22,"tag":51,"props":832,"children":833},{"style":70},[834],{"type":28,"value":835},"*",{"type":22,"tag":51,"props":837,"children":838},{"style":70},[839],{"type":28,"value":840}," to",{"type":22,"tag":51,"props":842,"children":843},{"style":86},[844],{"type":28,"value":845}," 'root'",{"type":22,"tag":51,"props":847,"children":848},{"style":578},[849],{"type":28,"value":850},"@",{"type":22,"tag":51,"props":852,"children":853},{"style":86},[854],{"type":28,"value":855},"'192.168.0.1'",{"type":22,"tag":51,"props":857,"children":858},{"style":578},[859],{"type":28,"value":860}," identified ",{"type":22,"tag":51,"props":862,"children":863},{"style":70},[864],{"type":28,"value":865},"by",{"type":22,"tag":51,"props":867,"children":868},{"style":86},[869],{"type":28,"value":870}," 'password'",{"type":22,"tag":51,"props":872,"children":873},{"style":70},[874],{"type":28,"value":875}," with",{"type":22,"tag":51,"props":877,"children":878},{"style":70},[879],{"type":28,"value":880}," grant",{"type":22,"tag":51,"props":882,"children":883},{"style":70},[884],{"type":28,"value":885}," option",{"type":22,"tag":51,"props":887,"children":888},{"style":578},[889],{"type":28,"value":581},{"type":22,"tag":110,"props":891,"children":892},{},[893],{"type":28,"value":894},"然后再输入下面两行命令",{"type":22,"tag":40,"props":896,"children":898},{"className":667,"code":897,"language":669,"meta":7,"style":7},"flush privileges;\nexit;\n",[899],{"type":22,"tag":47,"props":900,"children":901},{"__ignoreMap":7},[902,910],{"type":22,"tag":51,"props":903,"children":904},{"class":53,"line":54},[905],{"type":22,"tag":51,"props":906,"children":907},{"style":578},[908],{"type":28,"value":909},"flush privileges;\n",{"type":22,"tag":51,"props":911,"children":912},{"class":53,"line":92},[913],{"type":22,"tag":51,"props":914,"children":915},{"style":578},[916],{"type":28,"value":917},"exit;\n",{"type":22,"tag":30,"props":919,"children":921},{"start":920},8,[922],{"type":22,"tag":34,"props":923,"children":924},{},[925],{"type":28,"value":926},"为 firewalld 添加开放端口\n添加mysql端口3306",{"type":22,"tag":40,"props":928,"children":930},{"className":42,"code":929,"language":44,"meta":7,"style":7},"firewall-cmd --zone=public --add-port=3306\u002Ftcp --permanent\n# 重新加载\nfirewall-cmd --reload\n",[931],{"type":22,"tag":47,"props":932,"children":933},{"__ignoreMap":7},[934,957,966],{"type":22,"tag":51,"props":935,"children":936},{"class":53,"line":54},[937,942,947,952],{"type":22,"tag":51,"props":938,"children":939},{"style":58},[940],{"type":28,"value":941},"firewall-cmd",{"type":22,"tag":51,"props":943,"children":944},{"style":64},[945],{"type":28,"value":946}," --zone=public",{"type":22,"tag":51,"props":948,"children":949},{"style":64},[950],{"type":28,"value":951}," --add-port=3306\u002Ftcp",{"type":22,"tag":51,"props":953,"children":954},{"style":64},[955],{"type":28,"value":956}," --permanent\n",{"type":22,"tag":51,"props":958,"children":959},{"class":53,"line":92},[960],{"type":22,"tag":51,"props":961,"children":963},{"style":962},"--shiki-default:#6A737D;--shiki-dark:#6A737D",[964],{"type":28,"value":965},"# 重新加载\n",{"type":22,"tag":51,"props":967,"children":968},{"class":53,"line":117},[969,973],{"type":22,"tag":51,"props":970,"children":971},{"style":58},[972],{"type":28,"value":941},{"type":22,"tag":51,"props":974,"children":975},{"style":64},[976],{"type":28,"value":977}," --reload\n",{"type":22,"tag":30,"props":979,"children":981},{"start":980},9,[982],{"type":22,"tag":34,"props":983,"children":984},{},[985],{"type":28,"value":986},"修改mysql的字符编码（不修改会产生中文乱码问题）\n显示原来编码：",{"type":22,"tag":40,"props":988,"children":990},{"className":667,"code":989,"language":669,"meta":7,"style":7},"show variables like '%character%';\n",[991],{"type":22,"tag":47,"props":992,"children":993},{"__ignoreMap":7},[994],{"type":22,"tag":51,"props":995,"children":996},{"class":53,"line":54},[997,1002,1007,1012],{"type":22,"tag":51,"props":998,"children":999},{"style":578},[1000],{"type":28,"value":1001},"show variables ",{"type":22,"tag":51,"props":1003,"children":1004},{"style":70},[1005],{"type":28,"value":1006},"like",{"type":22,"tag":51,"props":1008,"children":1009},{"style":86},[1010],{"type":28,"value":1011}," '%character%'",{"type":22,"tag":51,"props":1013,"children":1014},{"style":578},[1015],{"type":28,"value":581},{"type":22,"tag":110,"props":1017,"children":1018},{},[1019],{"type":22,"tag":344,"props":1020,"children":1022},{"alt":7,"src":1021},"https:\u002F\u002Fupload-images.jianshu.io\u002Fupload_images\u002F16281566-d8183a07edf14f58.png?imageMogr2\u002Fauto-orient\u002Fstrip%7CimageView2\u002F2\u002Fw\u002F932\u002Fformat\u002Fwebp",[],{"type":22,"tag":110,"props":1024,"children":1025},{},[1026],{"type":28,"value":1027},"修改\u002Fetc\u002Fmy.cnf",{"type":22,"tag":40,"props":1029,"children":1033},{"className":1030,"code":1031,"language":1032,"meta":7,"style":7},"language-ini shiki shiki-themes github-light github-dark","[mysqld]\ncharacter_set_server=utf8\ninit_connect='SET NAMES utf8'\n","ini",[1034],{"type":22,"tag":47,"props":1035,"children":1036},{"__ignoreMap":7},[1037,1045,1053],{"type":22,"tag":51,"props":1038,"children":1039},{"class":53,"line":54},[1040],{"type":22,"tag":51,"props":1041,"children":1042},{},[1043],{"type":28,"value":1044},"[mysqld]\n",{"type":22,"tag":51,"props":1046,"children":1047},{"class":53,"line":92},[1048],{"type":22,"tag":51,"props":1049,"children":1050},{},[1051],{"type":28,"value":1052},"character_set_server=utf8\n",{"type":22,"tag":51,"props":1054,"children":1055},{"class":53,"line":117},[1056],{"type":22,"tag":51,"props":1057,"children":1058},{},[1059],{"type":28,"value":1060},"init_connect='SET NAMES utf8'\n",{"type":22,"tag":110,"props":1062,"children":1063},{},[1064],{"type":28,"value":764},{"type":22,"tag":40,"props":1066,"children":1067},{"className":42,"code":767,"language":44,"meta":7,"style":7},[1068],{"type":22,"tag":47,"props":1069,"children":1070},{"__ignoreMap":7},[1071],{"type":22,"tag":51,"props":1072,"children":1073},{"class":53,"line":54},[1074,1078,1082],{"type":22,"tag":51,"props":1075,"children":1076},{"style":58},[1077],{"type":28,"value":378},{"type":22,"tag":51,"props":1079,"children":1080},{"style":86},[1081],{"type":28,"value":783},{"type":22,"tag":51,"props":1083,"children":1084},{"style":86},[1085],{"type":28,"value":388},{"type":22,"tag":1087,"props":1088,"children":1089},"style",{},[1090],{"type":28,"value":1091},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":7,"searchDepth":117,"depth":117,"links":1093},[1094,1095],{"id":25,"depth":92,"text":25},{"id":262,"depth":92,"text":262},"markdown","content:blog:2020-05-12-centos-mysql80.md","content","blog\u002F2020-05-12-centos-mysql80.md","blog\u002F2020-05-12-centos-mysql80","md",[1103,1106],{"_path":1104,"title":1105},"\u002Fblog\u002F2020-05-12-centos-mysql57","Centos 7.3 安装 MySQL 5.7",{"_path":1107,"title":1108},"\u002Fblog\u002F2020-05-12-mysql-binlog","MySQL 开启 binlog",1796523532994]