目标操作系统: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选项为大写)
在CentOS 6.5 64Bit系统上,MySQL和PostgreSQL安装后,其默认超级管理员密码为空。MySQL的root用户可以使用`mysqladmin`命令设置新密码。PostgreSQL的postgres用户需要通过切换用户并使用`psql`命令修改密码。PostgreSQL的pg_hba.conf文件中,METHOD字段应为trust以允许密码验证。如果为ident,需要修改并重启服务以应用更改。
1万+

被折叠的 条评论
为什么被折叠?



