[root@localhost ~]# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 111350
Server version: 5.0.67-community-log MySQL Community Edition (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> |
[root@localhost ~]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) |
喜欢简单 说:
skip-grant-tables是不是有这个啊
realzyy@gmail.com 说:
看看my.cnf里面是不是把密码写进去了 |
root 3594 1 0 2009 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/lib/mysql/localhost.pid
mysql 3629 3594 1 2009 ? 1-15:12:49 /usr/sbin/mysqld --basedir=/ --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/DBs1.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock |
# If you install MySQL on some other places than /, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
# below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files. |
[client]
user=root
password=xxxx |
yahoon 说:
mysql客户端登录的时候首先用/etc/my.cnf的选项,然后看~/.my.cnf
我估计是这么回事
所以你可以对不同的用户在此定义用户密码其他的选项 ,然后用户直接输入mysql就登录进去了不需要知道密码
walkerxk@gmail.com 说:
我这直接回车是用我的linux用户名登录
喜欢简单 说:
你可以把.my.cnf拷贝到你的目录下
以后不用root身份 也可以
walkerxk@gmail.com 说:
~/.my.cnf相当于是/etc/my.cnf的个人用户版。
walkerxk@gmail.com 说:
是的,我从来不用root,root用户直接passwd -l锁掉的
mysqldump和其他命令应该也一样吧
mysqld肯定不会,其他应该都一样。 |