关于设置“权限”在MySql中
我使用 PhpMyAdmin 来设置 mysql 表等。
我还拥有对所有内容的根(完全)访问权限。
目前我在 phpMyAdmin 的权限选项卡下有这个:
USER: HOST: PASS: GLOB PRIVILEGES:
phpmyadmin localhost Y USAGE No
root 127.0.0.1 Y ALL PRIVILEGES Y
root localhost Y ALL PRIVILEGES Y
root domain.com Y ALL PRIVILEGES Y
db1 localhost Y ALL PRIVILEGES Y
db2 localhost Y ALL PRIVILEGES Y
user localhost Y USAGE No
我用它通过 PHP 连接:
$dbhost ='localhost';
$dbuser ='db2';
$dbpass ='password_here';
$dbname ='db2';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname,$conn) or die(mysql_error());
mysql_set_charset('utf-8', $conn);
让我困惑的是,如果我更改用户的密码,让我们说“db2
”,然后尝试在我的 PHP 代码中使用它进行连接,我无法访问。我使用旧密码,即使我在 phpMyAdmin 中更改密码到数据库,它仍然有效。 我什至不记得设置第一个密码,那肯定是很久以前的事了。 这是我的第一个问题! 顺便说一句,当我单击“更改权限”时,显示是否应该使用密码的字段将在下拉列表中显示“不要更改密码”。它不应该说“使用文本字段”之类的东西吗?
其次,我需要知道它应该如何设置,从开始到结束......
我有自己的服务器,我是维护自己的服务器的菜鸟,但我每天都在学习。
但这个信息我在网上没有找到。
我需要在我的服务器上设置什么?我的.cnf? ETC...
I use PhpMyAdmin to setup mysql tables and such.
I also have root (full) access to everything.
Currently I have this in my phpMyAdmin under the privileges tab:
USER: HOST: PASS: GLOB PRIVILEGES:
phpmyadmin localhost Y USAGE No
root 127.0.0.1 Y ALL PRIVILEGES Y
root localhost Y ALL PRIVILEGES Y
root domain.com Y ALL PRIVILEGES Y
db1 localhost Y ALL PRIVILEGES Y
db2 localhost Y ALL PRIVILEGES Y
user localhost Y USAGE No
And I use this to connect via PHP:
$dbhost ='localhost';
$dbuser ='db2';
$dbpass ='password_here';
$dbname ='db2';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die('Error connecting to mysql');
mysql_select_db($dbname,$conn) or die(mysql_error());
mysql_set_charset('utf-8', $conn);
What confuses me is that if I change the password of the user lets say "db2
" to something, and try using that in my PHP code for connecting, I don't get access. I am using an old password and it works even though I change passwords in phpMyAdmin to the database.
I don't even remember setting the first password up, it must have been a long time ago.
Thats my first problem!
Btw, when I click "change privileges", then the fields where it says if it is supposed to use password or not, is displaying "Dont change the password" from the drop list. Shouldn't it say something like "Use textfield"?
Second is that I need to know how it SHOULD be set up, from the start to end...
I have my own server and I am a rookie at maintaining my own servers, but I am learning everyday.
But this information is something I didn't find on the web.
What do I need to setup on my server? my.cnf? etc...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试
try