ubuntu 安装 mysql
2015-08-31 20:48
483 查看
mysql error number 2003
Can't connect to MySQL server xxx.xxx.xxx.xxx (10061)
在ubuntu 9.04中默认安装了mysql,默认只能本地访问,google了一下:
采用
登录到MySQL服务器端,在mysql库下执行
grant all on *.* to 'remote'@'172.16.21.39' identified by 'password';
即可
如果要设置为任何客户端都可以以root连接的话,可以这么写:
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
类似这用方法的整理如下:
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
2. 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码
但问题仍没有解决:
找到 命令 mysql> flush privileges //使修改生效
显示影响了零行。
问题依然没有解决,重新启动mysql sudo /etc/init.d/mysql restart
还是不行。
从 http://www.blogjava.net/waterjava/archive/2008/04/27/196385.html
了解到mysql有本机绑定,找到问题所在。
编辑 /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
将”bind-address = 127.0.0.1“注释
sudo /etc/init.d/mysql restart重启即可远程访问
问题解决
****************************************************************************************
root@kiki-desktop:/etc/apache2# apt-get install libapache2-mod-auth-mysql
apt-get install lighttpd
apt-get install openssl
root@kiki-desktop:/etc/apache2# apt-get install libapache2-mod-gnutls
$ mysql -u root -p
mysql> use authz_db;
mysql> CREATE TABLE users(
-> user_name CHAR(30) NOT NULL,
-> user_passwd CHAR(20) NOT NULL,
-> PRIMARY KEY (user_name)
-> );
mysql> GRANT SELECT
-> ON authz_db.users
-> TO authuser@localhost
-> IDENTIFIED BY 'Your Password Here';
mysql> flush privileges;
mysql> INSERT INTO users VALUES('test',ENCRYPT('TEST'));
root@kiki-desktop:/etc/apache2# chkconfig --level 35 mysqld on
---------------------------------
如果要设置为任何客户端都可以以root连接的话,可以这么写:
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
进入mysql,
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
root@kiki-desktop:/etc/mysql# vim /etc/mysql/my.cnf
编辑 /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
将”bind-address = 127.0.0.1“注释
root@kiki-desktop:/etc/mysql# /etc/init.d/mysql restar
ubuntu mysql远程连接
http://blog.csdn.net/helen_shw/archive/2010/01/22/5224524.aspxkiki@kiki-desktop:/etc/apache2mysql error number 2003
Can't connect to MySQL server xxx.xxx.xxx.xxx (10061)
在ubuntu 9.04中默认安装了mysql,默认只能本地访问,google了一下:
采用
登录到MySQL服务器端,在mysql库下执行
grant all on *.* to 'remote'@'172.16.21.39' identified by 'password';
即可
如果要设置为任何客户端都可以以root连接的话,可以这么写:
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
格式:grant select on 数据库.* to 用户名@登录主机 identified by "密码"
类似这用方法的整理如下:
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
mysql -u root -pvmwaremysql>use mysql;mysql>update user set host = '%' where user = 'root';mysql>select host, user from user; |
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; |
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; |
找到 命令 mysql> flush privileges //使修改生效
显示影响了零行。
问题依然没有解决,重新启动mysql sudo /etc/init.d/mysql restart
还是不行。
从 http://www.blogjava.net/waterjava/archive/2008/04/27/196385.html
了解到mysql有本机绑定,找到问题所在。
编辑 /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
将”bind-address = 127.0.0.1“注释
sudo /etc/init.d/mysql restart重启即可远程访问
问题解决
****************************************************************************************
root@kiki-desktop:/etc/apache2# apt-get install libapache2-mod-auth-mysql
apt-get install lighttpd
apt-get install openssl
root@kiki-desktop:/etc/apache2# apt-get install libapache2-mod-gnutls
$ mysql -u root -p
mysql> use authz_db;
mysql> CREATE TABLE users(
-> user_name CHAR(30) NOT NULL,
-> user_passwd CHAR(20) NOT NULL,
-> PRIMARY KEY (user_name)
-> );
mysql> GRANT SELECT
-> ON authz_db.users
-> TO authuser@localhost
-> IDENTIFIED BY 'Your Password Here';
mysql> flush privileges;
mysql> INSERT INTO users VALUES('test',ENCRYPT('TEST'));
root@kiki-desktop:/etc/apache2# chkconfig --level 35 mysqld on
---------------------------------
如果要设置为任何客户端都可以以root连接的话,可以这么写:
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
进入mysql,
grant all on *.* to 'root'@'%' identifiied by 'root的密码'
root@kiki-desktop:/etc/mysql# vim /etc/mysql/my.cnf
编辑 /etc/mysql/my.cnf
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1
将”bind-address = 127.0.0.1“注释
root@kiki-desktop:/etc/mysql# /etc/init.d/mysql restar
相关文章推荐
- MySQL基本操作(三):字符集
- MySQL存储过程之参数和复合语句
- mysql判断一个字符串是否包含某子串【转】
- MySQL存储过程之特征子句
- Powerdesigner15-用jdbc链接MySQL实现逆向工程步骤
- MySQL命令行导入导出数据
- mysql 主从配置
- mysql的text字段长度
- 解决mysql出现几个l的问题
- mysql 赋予远程访问权限
- MySQL取整函数
- mysql查看历史执行的sql
- MySQL存储过程之创建第一个存储过程
- Mysql Innodb 引擎优化(-)
- mysql常用部分
- mysql常用函数
- 每天进步一点点————优化MySQL SERVER(1)InnoDB篇
- MySql的join(连接)查询 (三表 left join 写法)
- x64 release模式下mysql编译连接错误解决办法
- MySQL配置文件my.cnf 例子最详细翻译