在mysql/bin目录下有个是mysqladmin工具用来管理和操作mysql用的,我们用他来给 root 加上密码
[root@localhost mysql]#bin/mysqladmin -uroot password 123456
这样我们就给root设置了 123456 这个密码
再次登录
[root@localhost mysql]# bin/mysql
上次我们使用这个命令连接mysql,看看密码是否生效。
[root@localhost mysql]# bin/mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost mysql]#
进不去了,说明密码设置成功。
我们在用密码试试,这时应该说明是什么用户登录,这里我们用的是 root 这个用户。
[root@localhost mysql]# bin/mysql -uroot -p
Enter password: 这里密码是不显示的,不要按错键盘就行
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18 to server version: 5.0.2-alpha
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
http://linux.chinaunix.net/techdoc/net/2006/05/04/931831.shtml
原创
©著作权归作者所有:来自51CTO博客作者xg2007524的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
05 ADO.net
ADO.NET就是一组类库 操作数据库用的。
.net 数据库 -
Golang - net/http 笔记
net/http 包的学习笔记
golang http 开发语言 json 自定义