博文

目前显示的是标签为“mysql命令”的博文

mysql命令行下用户管理

mysql安装后好,会有一个名字为mysql的数据库,存放用户的表是user,mysql数据库的用户管理就是围绕这个表展开的,当然还有一些表,例如:tables_priv,procs_priv,clumns_priv,information_schema数据库里面的USER_PRIVILEGES等。 安装完成后,如果需要远程连接,可以这样: 1、MYSQL服务器上: 比如: C:\>mysql -uroot -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.22-rc-community-log MySQL Community Server (GPL) Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. mysql> grant all privileges on *.* to ‘yourname’@’%’ identified by ‘youpasswd’; Query OK, 0 rows affected (0.05 sec) mysql> flush privileges; Query OK, 0 rows affected (0.06 sec) mysql> exit Bye 再把/etc/mysql/my.cnf中的bind-address=127.0.0.1注释了就可以远程连接了。 grant 权限名(sqlserver和mysql不一样的,可以看手册知道,分所有的权限用all) on 库名(*表全部).表名 to 要授权的用户名@”%”(%表示所有的IP,可以只些一个IP) identified by “密码”; 例: grant all privileges on *.* to root@”%” identified by ...