VC源码,用下面方法连接数据库没问题:
mysql_real_connect(&mysql,"localhost","root",NULL,"confdb",0,NULL,0)
现在我想改用下面的字符串来连接:
mysql_real_connect(&mysql,"localhost","admin","admin","confdb",0,NULL,0)
数据库应该怎样修改用户和密码?谢谢!!
mysql_real_connect(&mysql,"localhost","root",NULL,"confdb",0,NULL,0)
现在我想改用下面的字符串来连接:
mysql_real_connect(&mysql,"localhost","admin","admin","confdb",0,NULL,0)
数据库应该怎样修改用户和密码?谢谢!!
grant all privileges on confdb.* to admin@'localhost' identified by 'admin';
flush privileges;
set password=password(...);当前用户
set password for user@localhost =passwprd();指定用户;
修改用户:既重名用户
rename user to user@localhost或则
先删除:
drop user user@localhost;
再建立
create user user@localhost identified by '...' 以上不需要flush privileges用update mysql.user表的话,需要flush privileges;-----以上是修改本地登入的帐号,要修改远程的话 把localhost 改成 '%';
grant all on *.* to user@localhost;2楼的一个错误:
rename user olduser to newuser@localhost
grant all privileges on confdb.* to admin@'localhost' identified by 'admin';这句就行了。
不需要FLUSH
flush privileges;
2楼已经说明了