Re: starting multiple instances with mysqld_multi

2010-05-14 Thread Yang Wang
Hi,Nitin

Below information for your reference.

for my.cnf

[mysqld5129]
port=5506
socket=/tmp/mysql5129.sock
basedir=/opt/MySQL5129
datadir=/opt/MySQL5129/var
user=mysql
log-error=/var/log/mysqld5129.log
pid-file=/tmp/mysqld5129.pid
#log-bin=/opt/MySQL5129/binlog
long_query_time=2
log-slow-queries=/opt/MySQL5129/slowlog
default-character-set=utf8


[mysqld607]
port=5507
socket=/tmp/mysql607.sock
basedir=/opt/MySQL607
datadir=/opt/MySQL607/var
user=mysql
log-error=/var/log/mysqld607.log
pid-file=/tmp/mysqld607.pid
bind-address=127.0.0.1
skip-name-resolve


For start/stop 
==
-bash-3.1# cat /opt/MySQL5129start.sh
/opt/MySQL5129/bin/mysqld_multi start 5129
-bash-3.1# cat /opt/MySQL5129stop.sh
/opt/MySQL5129/bin/mysqld_multi stop 5129

-bash-3.1# cat /opt/MySQL607start.sh
/opt/MySQL607/bin/mysqld_multi start 607
-bash-3.1# cat /opt/MySQL607stop.sh
/opt/MySQL607/bin/mysqld_multi stop 607
==


Best Regards!
Yang Wang
 
Email: yw...@lfm-agile.com.hk
- Original Message - 
From: Nitin Mehta ntn...@yahoo.com
To: Prabhat Kumar aim.prab...@gmail.com
Cc: mysql@lists.mysql.com
Sent: Tuesday, May 11, 2010 6:19 PM
Subject: Re: starting multiple instances with mysqld_multi


Thanks, Prabhat! You're very right, but did you read the questions I asked?







From: Prabhat Kumar aim.prab...@gmail.com
To: Nitin Mehta ntn...@yahoo.com
Cc: mysql@lists.mysql.com
Sent: Tue, May 11, 2010 11:54:22 AM
Subject: Re: starting multiple instances with mysqld_multi

Hi,

You can run multiple instances on the same host and specify configuration 
options either by adding the options as arguments on the command line, or by 
storing them in configuration files.

for example, from the command line:

shell mysqld --port 3306 --log=/path/to/server1/log
shell mysqld --port 3307 --log=/path/to/server2/log


So, when MySQL starts up it reads various config files in sequence. This means 
that you can set global options for all instances in one file and then specific 
options for individual instances in separate files.

The files it reads by default are (on linux)


/etc/my.cnf
the_mysql_data_dir/my.cnf
~/.my.cnf

You can direct the server to read specific config files after it reads the 
default /etc/my.cnf file with the following directive.

--defaults-extra-file=/path/to/extra/config/file

So, if you wanted 2 instances running with some shared options and some 
specific options, you could create additional configuration files in /etc say:

/etc/my.server1.cnf
/etc/my.server2.cnf

where my.server1.cnf has the following lines:

port=3306
log=/path/to/log/file/for/server1
(other options here)

and my.server2.cnf is:

port=3307
log=/path/to/log/file/for/server2
(other options here)

then you could start the separate instances of mysqld as follows:

shell mysqld --defaults-extra-file=/etc/my.server1.cnf
shell mysqld --defaults-extra-file=/etc/my.server2.cnf

about mysqld_multi
mysqld_multi
mysqld_multi [ options] {start| stop| report} [ server_id]
Use this to run multiple MySQL servers on different socket files and ports. To 
set up
multiple servers, a different section of server options must be entered into a 
configuration file (e.g., /etc/my.cnf). The naming scheme for each section 
must be [mysqldn]
where n is a different number for each server. Options must be entered 
separately for
each server in its own section, even when servers use the same options. At a 
minimum,
each server should use a different socket file and a different TCP/IP port. To 
see an
example of how a configuration file might be set up for multiple servers, 
enter the
following from the command line:
mysqld_multi --example
Once multiple servers have been configured, to start a server, you can enter 
something
like the following from the command line:
mysqld_multi start 3
This line would start server number 3 listed in the configuration file as 
[mysqld3]. By
entering report for the first argument, you can obtain the status on the 
server. For
starting and stopping the server, this script uses the mysqladmin utility. 
Here is an
alphabetical list of options specific to mysqld_multi that you can enter from 
the
command line, along with a brief explanation of each:
--config-file=filename
Specifies the path and name of the server’s configuration file if it is 
different from
the default.
--example
Displays a sample configuration file.
--help
Displays basic help information.
--log=filename
Sets the path and name of the logfile. The default is /tmp/mysqld_multi.log.
--mysqladmin=path
Sets the path to the mysqladmin utility.
--mysqld=path
Specifies the path to mysqld.
--no-log
Instructs the utility not to save messages to a log, but to send them to 
stdout
instead.
--password=password
Provides the password for using mysqladmin.
--tcp-ip
Enables TCP/IP communication with the server

Re: compile 5.5.4-m3 on centos 5.0

2010-04-19 Thread Yang Wang
Hi, Joerg

Thanks you very much.
I slove it with second method(hack sql/share/Makefile 
http://lists.mysql.com/commits/102846).



r...@localhost:(none) 09:09:30select version();
+---+
| version() |
+---+
| 5.5.4-m3  |
+---+
1 row in set (0.00 sec)


r...@localhost:(none) 09:06:19show engines;
++-++--+--++
| Engine | Support | 
Comment| Transactions | 
XA   | Savepoints |
++-++--+--++
| InnoDB | YES | Supports 
transactions, row-level locking, and foreign keys | YES  | YES  | 
YES|
| MRG_MYISAM  | YES | Collection of identical 
MyISAM tables  | NO   | NO   | NO |
| MEMORY   | YES | Hash based, stored in 
memory, useful for temporary tables  | NO   | NO   | NO |
| BLACKHOLE | YES | /dev/null storage engine 
(anything you write to it disappears) | NO   | NO   | NO |
| CSV | YES | CSV storage 
engine | NO   | NO   | NO   
  |
| MyISAM  | DEFAULT | Default engine as of 
MySQL 3.23 with great performance | NO   | NO   | NO |
| ARCHIVE| YES | Archive storage engine 
| NO   | NO   | NO |
| FEDERATED   | NO  | Federated MySQL storage 
engine | NULL | NULL | NULL   |
| PERFORMANCE_SCHEMA | YES | Performance Schema 
| NO   | NO   | NO |
++-++--+--++
9 rows in set (0.00 sec)

r...@localhost:(none) 09:06:52show plugins;
+-+--++-+-+
| Name  | Status   | Type   | 
Library | License |
+-+--++-+-+
| binlog | ACTIVE   | STORAGE ENGINE | NULL| GPL |
| CSV  | ACTIVE   | STORAGE ENGINE | NULL| GPL |
| MEMORY  | ACTIVE   | STORAGE ENGINE | NULL| GPL |
| MyISAM| ACTIVE   | STORAGE ENGINE | NULL| GPL |
| MRG_MYISAM| ACTIVE   | STORAGE ENGINE | NULL| GPL |
| partition   | ACTIVE   | STORAGE ENGINE | NULL| 
GPL |
| ARCHIVE  | ACTIVE   | STORAGE ENGINE | NULL| GPL |
| BLACKHOLE   | ACTIVE   | STORAGE ENGINE | NULL| GPL |
| FEDERATED| DISABLED | STORAGE ENGINE | NULL| GPL |
| InnoDB  | ACTIVE   | STORAGE ENGINE | NULL| GPL   
  |
| INNODB_TRX  | ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_LOCKS| ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_LOCK_WAITS   | ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_CMP  | ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_CMP_RESET| ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_CMPMEM   | ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| INNODB_CMPMEM_RESET | ACTIVE   | INFORMATION SCHEMA | NULL| GPL |
| PERFORMANCE_SCHEMA  | ACTIVE   | STORAGE ENGINE | NULL| GPL |
+-+--++-+-+
18 rows in set (0.00 sec)





Best Regards!
Yang Wang
 

- Original Message - 
From: Joerg Bruehe joerg.bru...@sun.com
To: mysql@lists.mysql.com
Cc: Yang Wang yw...@lfm-agile.com.hk
Sent: Monday, April 19, 2010 9:32 PM
Subject: Re: compile 5.5.4-m3 on centos 5.0


Hi Yang Wang, everybody!


Yang Wang wrote:
 Dear All,
 
 I hit belown problem when i compile(make install) 5.5.4-M3 on centos 5.0.
 
 
 
 -bash-3.1# cat /etc/redhat-release
 CentOS release 5 (Final)
 
 -bash-3.1# uname -a
 Linux dbtest.lfm-agile.com.hk 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 
 2007

Re: Most data sort

2009-12-21 Thread Yang Wang
sample as below with group by and order by statment


mysql create table t2(name char(1),qty smallint);
Query OK, 0 rows affected (0.01 sec)

mysql insert into t2 
values('A',1),('B',2),('A',4),('A',1),('A',1),('B',1),('A',2),('C',2),('D',1),('C',4);
Query OK, 10 rows affected (0.00 sec)
Records: 10  Duplicates: 0  Warnings: 0

mysql select * from t2;
+--+--+
| name | qty  |
+--+--+
| A|1 |
| B|2 |
| A|4 |
| A|1 |
| A|1 |
| B|1 |
| A|2 |
| C|2 |
| D|1 |
| C|4 |
+--+--+
10 rows in set (0.00 sec)

mysql select name,sum(qty) as qty from t2 group by name order by qty desc;
+--+--+
| name | qty  |
+--+--+
| A|9 |
| C|6 |
| B|3 |
| D|1 |
+--+--+
4 rows in set (0.01 sec)




Best Regards!
Yang Wang
 

- Original Message - 
From: HaidarPesebe haidarpes...@gmail.com
To: MySQL Lists mysql@lists.mysql.com
Sent: Monday, December 21, 2009 3:31 PM
Subject: Most data sort


Dear All,

I need your help to how to call the database.

I've got a mysql database as follows:
--
Name | qty
-
 A 1
 B 2
 A 4
 A 1
 B 1
 A 2
 C 2
 D 1
 C 4

How calling if I want to sort the data according to the most, or the result 
will look like this

A = 7
C = 6
B = 3
D = 1

Thanks a lot
Haidarpesebe

Re: Update Doesn't Update!

2009-12-11 Thread Yang Wang
first desc products

or try to

update products set sizes='Small' where
SKU='prodSKU1';




Best Regards!
Yang Wang
 
Tel.: 0769-21687397
Fax.: 0769-21685577
Email: yw...@lfm-agile.com.hk
- Original Message - 
From: cars...@bitbybit.dk
To: Victor Subervi victorsube...@gmail.com
Cc: mysql@lists.mysql.com
Sent: Friday, December 11, 2009 6:13 PM
Subject: Re: Update Doesn't Update!


 
 On Fri, 11 Dec 2009 05:09:52 -0500, Victor Subervi
 victorsube...@gmail.com
 wrote:
 
 mysql update products set sizes=('Small', 'Large') where
 SKU='prodSKU1';
 Query OK, 0 rows affected, 1 warning (0.00 sec)
 Rows matched: 1  Changed: 0  Warnings: 1
 
 mysql show warnings;
 +-+--++
 | Level   | Code | Message|
 +-+--++
 | Warning | 1265 | Data truncated for column 'sizes' at row 1 |
 +-+--++
 1 row in set (0.00 sec)
 
 
 What do? How do I enter multiple values?
 
 Impossible to say, until you let us know how you defined the column in the
 first place...
 
 / Carsten
 
 
 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql?unsub=yw...@lfm-agile.com.hk


different 5.0 and 5.1 about long_query_time

2009-12-11 Thread Yang Wang
Hi,All

   The version of 5.1 include microtime slow query patch?



slow query log in version 5.1
__
# u...@host: root[root] @ localhost []
# Query_time: 0.94  Lock_time: 0.24 Rows_sent: 0  Rows_examined: 0
SET timestamp=1260514025;
UPDATE gamesession  SET session_expires = '1260515825', session_data = 
'ljuser|s:13:chenqingji008;task|s:2:52;' WHERE session_id = 
'79bfdd9840bdf4cdb19d19ff90dc0643';



version 5.0.45
___
r...@localhost:(none) 18:34:01show variables like '%long%';
+-+---+
| Variable_name   | Value |
+-+---+
| long_query_time | 10|
+-+---+
1 row in set (0.01 sec)

r...@localhost:(none) 18:35:41select version();
+---+
| version() |
+---+
| 5.0.45|
+---+
1 row in set (0.00 sec)
_



version 5.1.29
___
r...@localhost:(none) 18:36:56show variables like '%long%';
+-+--+
| Variable_name   | Value|
+-+--+
| long_query_time | 2.00 |
+-+--+
1 row in set (0.01 sec)

r...@localhost:(none) 18:36:58select version();
+---+
| version() |
+---+
| 5.1.29-rc-log |
+---+
1 row in set (0.00 sec)
__






Best Regards!
Yang Wang

Email: yw...@lfm-agile.com.hk