debian mysql 允许外部链接方法
1 modify the /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
#
you see the bind-address, comment it. 注掉它。
2 update the database -- mysql.
shell > mysql -uroot -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| mysql |
+--------------------+
5 rows in set (0.00 sec)
mysql> select t.host, t.user from user t;
+-----------+------------------+
| host | user |
+-----------+------------------+
|127.0.0.1 | debian-sys-maint |
|127.0.0.1 | james |
| 127.0.0.1 | root |
| debian | root |
| localhost | root |
+-----------+------------------+
5 rows in set (0.00 sec)
mysql > update user set host='%' where user='yourUsername';
mysql > flush privileges;
remark:
if wanna create user please follow:
create user 'james'@'%' identified by 'password';
相关文档:
修改和备份、批处理
有时我们要对数据库表和数据库进行修改和删除,可以用如下方法实现:
1、增加一列:
如在前面例子中的mytable表中增加一列表示是否单身single:
mysql> alter table mytable add column single char(1);
2、修改记录
将abccs的single记录修改为“y”:
mysql> ......
笔者(mqboss)近期在做MySQL集群的技术调研,会陆续把自己的心得体会写出来和大家分享,请大家继续关注。
1.从mysq官方网站下载安装文件mysql-cluster-gpl-7.0.9-solaris10-sparc-64bit.tar.gz,并通过FTP上传到Solaris服务器上;
2.添加用户组mysql和用户mysql(注:mysql用户属于mysql用户组)
shell> groupadd mys ......
MYSQL where id in问题
SELECT * from product WHERE id IN (‘1522,1523,1524′)ORDER BY id DESC
在MYSQL里面执行这个语句只返回1522的值。
执行
SELECT * from product WHERE instr(‘1522,1523,1524′,id) ORDER BY id DESC
或者
SELECT * from product WHERE instr(‘1522,1523,1524 ......
mysql
有一个功能就是可以log下来运行的比较慢的sql语句,默认是没有这个log的,为了开启这个功能,要修改my.cnf或者在mysql
启动的时候加入一些参数。
如果在my.cnf里面修改,需增加如下几行
long_query_time = 10
log-slow-queries =
long_query_time
是指执行超过多久的sql会被log下来,这里是10秒。
log-slo ......