背景: 数据库链接不上,报错: root@localhost:/var/log/mysql# mysql -uzjy -p -h192.168.1.111 --default-character-set=utf8 -P3306 Enter password: ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0 分析方法…
1.启动MySQL服务:# service mysqld start 2.为MySQL设置root用户密码:# mysql -u root mysql>set password for root@localhost=password('此处是想要设置的密码'); 3.退出mysql:exit 4.用密码登陆mysql: # mysql -u root -p 5.开放远程登陆权限:GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '…