mysql

» 阅读全文

阅读全文

sun Microsystems今天早上公布了以8亿美元的现金和2亿美元期权收购开源数据库领导者mysql AB的计划.
无论是对于Sun还是MySQL,这都是天作之合,MySQL它永远不缺用户,它是LAMP中的“M”,世界上绝大多数Blog和Web2.0程序依赖它运行,对于Sun来说,收购MySQL将让它的创始人著名的“网络就是计算机”言论迈进一大步,通过收购MySQL将有助于增强公司的数据库产品线,例如你可能会更准确地说, "网络加数据库就是计算机" .



Sun微系统称,公司将以8亿美元的现金和MySQL的所有股票,并将MySQL提供价值约2亿美元的期权.Sun微系统称,MySQL的客户已包括了 Google、Facebook以及诺基亚等大公司,通过收购不仅将有助于增强公司的数据库产品线,而且还将增强公司在包括数据库市场的企业IT市场中的地位.通过收购MySQL,将使公司在价值150亿美元的数据库市场实现质的飞跃,并有助于公司同微软、IBM和甲骨文等竞争对手进行抗衡.

Sun已经对开源事业孤注一掷,包括solaris操作系统,Java和Ultra-Sparc,无一例外,它将成为对开源生态系统的最大贡献者,下一步Sun将会如何吞下并消化利用MySQL,让我们拭目以待.

» 阅读全文

阅读全文

前期服务器由于mysql4.1采用默认编译存储 latin1 字符集

在数据导出导入在默认编码utf-8环境中出现乱码情况

前天终于下定决心把数据库从latin1转换为utf-8,转换很顺利

可以正常显示中文汉字,但是在搜索和添加新文章时出现mysql错误

数据库出错:

MySQL Query Error
Mysql error description: Duplicate entry '0' for key 1
Mysql error number: 1062
Date: 2007-12-09 @ 06:36
http://www.XXX.com/admin/admincp.php?job=article

错误原因为在从latin1到utf-8转换过程中部分表属性丢失自动增量属性

解决办法:需要找到出错页面调用的数据库中的表和字段,这一步比较麻烦,需要在php代码中查询到操作的表;

[attach=0]

先把默认值改删除留空并选择增量属性后保存;否则会提示错误

解决过程中比较麻烦的就是找到出错的表的

在这里感谢Tice

ziduan.jpg

ziduan.jpg

大小: 20.57 K
尺寸:  x 
浏览: 1 次
点击打开新窗口浏览全图

阅读全文

Convert latin1 to utf-8 in mysql
From Gentoo Linux Wiki
Jump to: navigation, search
[edit]latin1 to UTF-8 in MySQL
Since MySQL 4.1, UTF-8 is the default charset. If you have an old database, containing data encoded in latin1, and you want upgrade to a newer MySQL server, than you have to do the following:

MySQL dump

First of all, we need to dump the old data into a file.




Code: Create a MySQL dump
$ mysqldump -h host.com --user=frog -p --default-character-set=latin1 -c \
--insert-ignore --skip-set-charset dbname > dump.sql




Please mention, that you have to replace the user, the host and the dbname, otherwise it will result in an error :)


Convert dump

Next thing to do is, converting the characters in the MySQL dump from latin1 to UTF-8




Code: Convert dump
$ iconv -f ISO-8859-1 -t UTF-8 dump.sql > dump_utf8.sql




If you have another source charset, you need to replace the -f option with your local character set.


Drop and create

Now it's time to drop the old database and create a new one with UTF-8 support.




Code: Drop and Create
$ mysql --user=frog -p --execute="DROP DATABASE dbname;
CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;"




Import dump to databse

Last but not least, we need to import the converted data back to the new database.




Code: Import dump
$ mysql --user=frog --max_allowed_packet=16M -p --default-character-set=utf8 dbname < dump_utf8.sql




The max_allowed_packet-option is sometimes important. If your import ends up with a "ERROR 1153 at line 42: Got a packet bigger than 'max_allowed_packet'", you need to increase the packet size. Please mention, that you also need to update /etc/mysql/my.cnf and set max_allowed_packet=16M under the [mysqld] directive

Retrieved from "http://gentoo-wiki.com/TIP_Convert_latin1_to_UTF-8_in_MySQL"

阅读全文

解决方法是修改/etc/mysql/my.cnf,添加以下一行:
set-variable = max_connections=500

或在启动命令中加上参数 max_connections=500
就是修改最大连接数,然后重启mysql.默认的连接数是100,太少了,所以容易出现如题错误.
以下是mysql.com网站的相关说明:
If you get a Too many connections error when you try to connect to the mysqld server, this means that all available connections are in use by other clients.

The number of connections allowed is controlled by the max_connections system variable. Its default value is 100. If you need to support more connections, you should restart mysqld with a larger value for this variable.

mysqld actually allows max_connections+1 clients to connect. The extra connection is reserved for use by accounts that have the SUPER privilege. By granting the SUPER privilege to administrators and not to normal users (who should not need it), an administrator can connect to the server and use SHOW PROCESSLIST to diagnose problems even if the maximum number of unprivileged clients are connected. See Section 13.5.4.19, “SHOW PROCESSLIST Syntax”.

The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform. Linux or Solaris should be able to support 500-1000 simultaneous connections, depending on how much RAM you have and what your clients are doing. Static Linux binaries provided by MySQL AB can support up to 4000 connections.

 

 PS:方法2

还有个办法就是到/usr/local/share/mysql/下面拷贝个配置文件my-large.cnf 到/etc目录下为my.cnf,再改最大连接数可以把mysql发挥到最大性能

/usr/local/share/mysql/

下有三个配置文件

my-large.cnf   大型数据库应用

my-medium.cnf  中型数据库应用

my-small.cnf    小型数据库应用

在选择 my-large.cnf的时候对内存要求比较高

在到webmin中mysql服务器的配置文件中修改mysql的最大连接数到4000就可以完美解决MySQL的“too many connections”错误了;

mysql连接数增加后内存占用也比较严重;

mysql1.png(缩略图)

mysql1.png

大小: 30.25 K
尺寸: 350 x 262
浏览: 37 次
点击打开新窗口浏览全图

mysql2.png(缩略图)

mysql2.png

大小: 17.42 K
尺寸: 350 x 176
浏览: 27 次
点击打开新窗口浏览全图

阅读全文

Total: 7Page 1 of 212Next ›