Open luandly opened 5 years ago
PCdeMacBook-Pro:~ pc$ vim .bash_profile PCdeMacBook-Pro:~ pc$ source .bash_profile PCdeMacBook-Pro:~ pc$ mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 14 Server version: 5.7.27
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> SET PASSWORD FOR 'root'@'localhost' = 'root'; Query OK, 0 rows affected (0.03 sec)
mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
mysql> quit;
04-输入 ./mysql/ 回车,输入 FLUSH PRIVILEGES; 用于跳过验证 回车,再输入 ALTER USER 'root'@'localhost' IDENTIFIED BY '你的新密码';
查看此目录下是否有mysql $ open /usr/local/mysql/bin 打开系统环境变量配置 $ vim ~/.bash_profile 1添加下面代码 export PATH=$PATH:/usr/local/mysql/bin 1执行命令使配置生效 $ source ~/.bash_profile 1.4.4 修改ip访问权限 // 参数文章https://blog.csdn.net/liuquan0071/article/details/62423674 // 授权所有数据库的所有表的所有权限给ip为任意值用户名为root密码为newpassword的用户 修改用户root在终端访问数据库的权限 $ GRANT ALL ON . TO 'root'@'%' IDENTIFIED BY 'newpassword'; 1刷新使刚修改的权限生效 $ flush privileges; 1现在可以使用ip访问数据库了.