查询tablename表中,field字段值重复的数据及重复次数
select field,count(*) as count from tablename group by field having count>1;
查询tablename表中,field字段值重复的数据及重复次数
select field,count(*) as count from tablename group by field having count>1;
可能的情况
1.端口27017未开放
2.开启认证,密码错误
3.在PHP中密码中有 @ 符号
字符与字节
ASCII码:一个英文字母(不分大小写)占一个字节的空间,一个中文汉字占两个字节的空间。一个二进制数字序列,在计算机中作为一个数字单元,一般为8位二进制数,换算为十进制。最小值0,最大值255。如一个ASCII码就是一个字节。
UTF-8编码:一个英文字符等于一个字节,一个中文(含繁体)等于三个字节。中文标点占三个字节,英文标点占一个字节
Unicode编码:一个英文等于两个字节,一个中文(含繁体)等于两个字节。中文标点占两个字节,英文标点占两个字节
不同数量级间
数据存储是以10进制表示,数据传输是以2进制表示的,所以1KB不等于1000B。
1KB=1024B;1MB=1024KB=1024×1024B。其中1024=210。
1B(byte,字节)= 8 bit(见下文);
1KB(Kibibyte,千字节)=1024B= 2^10 B;
1MB(Mebibyte,兆字节,百万字节,简称“兆”)=1024KB= 2^20 B;
1GB(Gigabyte,吉字节,十亿字节,又称“千兆”)=1024MB= 2^30 B;
1TB(Terabyte,万亿字节,太字节)=1024GB= 2^40 B;
1PB(Petabyte,千万亿字节,拍字节)=1024TB= 2^50 B;
1EB(Exabyte,百亿亿字节,艾字节)=1024PB= 2^60 B;
1ZB(Zettabyte,十万亿亿字节,泽字节)= 1024EB= 2^70 B;
1YB(Yottabyte,一亿亿亿字节,尧字节)= 1024ZB= 2^80 B;
1BB(Brontobyte,一千亿亿亿字节)= 1024YB= 2^90 B;
1NB(NonaByte,一百万亿亿亿字节) = 1024 BB = 2^100 B;
1DB(DoggaByte,十亿亿亿亿字节) = 1024 NB = 2^110 B;
[client]
port = 3306
socket = “D:/mysql/mysql.sock”
[mysqld]
port= 3306
socket = “D:/mysql/mysql.sock”
basedir = “D:/mysql”
tmpdir = “D:/tmp”
datadir = “D:/mysql/data”
pid_file = “mysql.pid”
key_buffer = 64M
max_allowed_packet = 512M
sort_buffer_size = 5120K
net_buffer_length = 256K
read_buffer_size = 1024K
read_rnd_buffer_size = 5120K
myisam_sort_buffer_size = 256M
log_error = “mysql_error.log”
lower_case_table_names=1
plugin_dir = “D:/mysql/lib/plugin/”
server-id = 1
innodb_data_home_dir = “D:/mysql/data”
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = “D:/mysql/data”
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 32M
innodb_log_file_size = 640M
innodb_log_buffer_size = 64M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50
wait_timeout = 2880000
interactive_timeout = 2880000
[mysqldump]
quick
max_allowed_packet = 512M
[mysql]
no-auto-rehash
[isamchk]
key_buffer = 200M
sort_buffer_size = 200M
read_buffer = 32M
write_buffer = 32M
[myisamchk]
key_buffer = 200M
sort_buffer_size = 200M
read_buffer = 32M
write_buffer = 32M
[mysqlhotcopy]
interactive-timeout
centos7 安装双mysql
之前安装了mysql的5.6.19 现在继续安装此版本主要用于主从复制
1.安装cmake (网上自行下载mysql5.6.19)
wget http://www.cmake.org/files/v2.8/cmake-2.8.10.2.tar.gz
tar -xzvf cmake-2.8.10.2.tar.gz
cd cmake-2.8.10.2
./bootstrap
make && make install
安装一下工具
yum -y install wget gcc-c++ ncurses ncurses-devel cmake make perl bison openssl openssl-devel gcc* libxml2 libxml2-devel curl-devel libjpeg* libpng* freetype*
cd mysql-5.6.16
安装mysql
cmake \
-DCMAKE_INSTALL_PREFIX=/data/mysql3307 \
-DMYSQL_UNIX_ADDR=/data/mysql3307/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DMYSQL_DATADIR=/data/mysql3307/data \
-DMYSQL_TCP_PORT=3307 \
-DENABLE_DOWNLOADS=1
初始化mysql
scripts/mysql_install_db –basedir=/usr/local/mysql3307/ –user=mysql
修改mysql的配置
vi /usr/local/mysql3307/etc/my.cnf
[client]
port = 3307 –数据库端口号
socket = /data/mysql3307/mysql.sock –sock文件路径
default-character-set=utf8 –客户端UTF8连接
[mysqld]
port = 3307 –数据库端口号
socket = /data/mysql3307/mysql.sock –sock文件路径
安装mysql的系统服务
support-files/mysql.server /etc/init.d/mysql3307
vi /etc/init.d/mysql3307
basedir=/data/mysql3307
datadir=/data/mysql3307/data
mysqld_pid_file_path=/data/mysql3307/mysql11.pid
保存成功后试试
/etc/init.d/mysql3307 start