Ubuntu11 mysql 初始密码及远程连接设置

1.初始密码

    # cat /etc/mysql/debian.cnf

 

打印如下

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = jgOaVkxkgDrOq0uS
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = jgOaVkxkgDrOq0uS
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr
  

    #mysql -udebian-sys-maint -pjgOaVkxkgDrOq0uS

    #grant all privileges on *.* to root@'localhost(或者远程用%)' identified by '密码' with grant option;

    #flush privileges;

 

 

2.远程连接

    #grant all privileges on *.* to root@'%' identified by '密码' with grant option;

    #sudo vi /etc/mysql/my.cnf
   

bind-address           = 127.0.0.1 这一行要注释掉

#bind-address           = 127.0.0.1

    

你可能感兴趣的:(SQL)