🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
1. 连接mysql ~~~php mysql - u root - p; ~~~ >[info] root 用户名 >输入命令之后 提示输入输入密码 2. 创建外网连接用户 ~~~php GRANT ALL PRIVILEGES ON *.* TO 'name'@'%' IDENTIFIED BY 'pwd' WITH GRANT OPTION; grant all privileges on *.* to 'name'@'%' identified by 'pwd' with grant option; grant select on database . * to 'name'@localhost identified by 'pwd'; ~~~ >[info] name 表示创建的用户名 > % 表示可以以任意方式连接 > pwd 用户的登录密码 3. 查询已经创建的用户 ~~~php SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user; select distinct concat('user: ''',user,'''@''',host,''';') as query from mysql.user; ~~~ 4. 退出 断开连接 ~~~php exit; ~~~ 5. 查看端口号 ~~~php show global variables like 'port'; ~~~ 6. 查看版本号码 ~~~php select version(); ~~~