Ubuntu20.04安装mysql数据库教程1、⾸先安装mysql程序
命令:sudo apt install mysql-server
2、安装完查看mysql启动状态:
命令:systemctl status mysql
3、配置mysql中root密码:
sudo mysql_secure_installation
Securing the MySQL server deployment.
Connecting to MySQL using a blank password.
access转mysql教程视频VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?
Press y|Y for Yes, any other key for No:
这⾥输⼊:Y
There are three levels of password validation policy:
LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG:
这⾥是密码强度:我服务器搭建的所以我选择:0
Please set the password for root here.
New password:
Re-enter new password:
Estimated strength of the password: 50
这⾥是创建密码,
其余的下⾯全部是Y就可以了
4、登录root⽤户:
如果登⼊⽤户错:Enter password:
ERROR 1698 (28000): Access denied for user 'root'@'localhost'
需要重置root⽤户密码:
先查看获取默认⽤户: sudo vim /etc/mysql/debianf
到:        ⽤户名:user    = debian-sys-maint
密码:password = ecMdhCUfmsLmyGOq
⽤默认⽤户登录:
修改密码:alter user root@localhost identified with mysql_native_password by '这⾥是密码';                修改成功字样:Query OK, 0 rows affected (0.01 sec)
执⾏:flush privileges;使密码⽣效,然后使⽤root⽤户登录。
5、创建⾃⼰的⽤户:
create user '⽤户名'@'%' identified with mysql_native_password by '密码';
6、授权⽤户远程登录:
grant all privileges on *.* to '⽤户'@'%' with grant option;
7、刷新策略:flush privileges;
完成了,直接远程登录。
如果远程登录不上错误10038需要修改⼀个⽂件,
修改⼀个配置⽂件:sudo vim /etc/f.d/mysqldf        注释掉:#bind-address    = 127.0.0.1
然后重启mysql服务,即可远程登录了

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。