赞
踩
apt-get install mysql-server=5.7.33-0ubuntu0.16.04.1
安装的过程中需要设置root的密码,根据提示操作即可
安装完成后默认只能本地访问,如果需要其他地址也可以访问需做如下操作
编辑配置文件
vim /etc/mysql/mysql.conf.d/mysqld.cnf
对以下行进行注释或者修改
# bind-address = 127.0.0.1
完成后对文件进行保存
同时对root用户的权限进行如下操作
mysql -uroot -p123456
grant all privileges on *.* to 'root'@'%' identified by '123456';
flush privileges;
查询用户信息
select host,user from mysql.user;
退出mysql quit
service mysql restart
整个操作过程如下
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456'; Query OK, 0 rows affected, 1 warning (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> select host,user from mysql.user; +-----------+------------------+ | host | user | +-----------+------------------+ | % | root | | localhost | debian-sys-maint | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 5 rows in set (0.00 sec) mysql> quit Bye service mysql restart
此刻外部可正常访问
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。