目标操作系统:CentOS 6.5 64Bit MySQL和PostgreSQL默认安装 MySQL超级管理员缺省名称:root #mysql -u root 缺省密码为空,修改方法: # mysqladmin -u root password 'new password' ========================================== PostgreSQL超级管理员缺省用户为postgres,需要以该用户身份操作: #su postgres bash-4.1$ psql postgres=# alter user postgres with password 'new password' PostgreSQ缺省安装目录为 /var/lib/pgsql/data ,该目录下的pg_hba.conf内,METHOD字段应该为trust,以支持输入密码访问数据库,如果值为ident,需要参照下面内容修改: # TYPE DATABASE USER CIDR-ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust # IPv4 local connections: host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 trust 修改配置文件后,重新启动数据库服务: #service postgresql restart 连接数据库: # psql -U postgres -W(-U选项为大写) (责任编辑:IT) |