前置条件
- ubuntu 16.04
- mysql-server-5.7
安装步骤
apt-get updateapt-get installl mysql-server-5.7复制代码
对于出现的提示选择 y 就好 ,然后输入root密码。安装完成
操作使用
- 远程连接mysql
mysql -h IP -P port -u root -pmysql -h 127.0.0.1 -P 3306 -u root复制代码
以下内容为转载
1.https://www.cnblogs.com/xujishou/p/6306765.html(MySQL5.7 添加用户、删除用户与授权)
疑难问题解决 (后续更新)
1.ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
复现root@itlvgo:~# mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)root@itlvgo:~# mysql -urootERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)复制代码
恩。原因是因为需要输入输入密码的命令,少输入了一个-p using password:NO 正确操作如下
root@itlvgo:~# mysql -uroot -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 14Server version: 5.7.22-0ubuntu0.16.04.1 (Ubuntu)Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> 复制代码
2.配置用户无法外网访问(本地可以)
/etc/mysql/mysql.conf.d配置如下信息port=3306// 原来的注释掉,默认127.0.0.1bind-address=0.0.0.0复制代码
如果还不可以,进行下面的检查操作
- 检查一下是否有开启防火墙;(云服务器的安全组配置)
- 如果开启不想关闭,需要开放mysql的占用端口,默认3306;
- 关闭防火墙。。