manipulating count group by statement
Hello everyone, I have a mysql table tha holds a variety of ip address. I am trying to work out a select statement that will give me a count(*) grouped by the first 2 octets of the ip. if the ip table contains: 10.102.1.1 192.168.123.34 192.168.123.4 192.168.123.43 192.168.123.3 192.168.0.27 192.168.0.212 10.102.1.54 10.102.1.75 10.102.1.62 10.102.1.12 10.102.1.10 10.102.1.111 how can my: SELECT ip, COUNT(*) from tbl_MasterIp group by ip; be changed so that I get back ipCOUNT(*) 10.102.1 20 192.168.12330 192.168.0 10 or whatever the ip counts should be. I have about 5 different octets within this table. I am using mysql 3.* Thanks for any help... Sincerely, Chad -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: safe_mysqld not letting go of tty on remote start
Actually evern if I hit enter it keeps the tty. The only way I can get it to release is to nohup the ${MYSQL}/bin/sae_mysqld, if not I actually have to shutdown the term window and reconnect.. Chad On Mon, 2003-07-21 at 13:57, gerald_clark wrote: > It writes a status message to the screen, and overwrites your shell prompt. > Hit enter, and you will probably find that you have a prompt afterall. > > chad kellerman wrote: > > >Hey guys, > > Anyone ever notice that when you restart mysql ( whether is be thru > >mysql.server or ${MYSQL}/bin/sae_mysqld the tty stays connected. > > > > Thanks, > >Chad > > > > > > > > > > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
safe_mysqld not letting go of tty on remote start
Hey guys, Anyone ever notice that when you restart mysql ( whether is be thru mysql.server or ${MYSQL}/bin/sae_mysqld the tty stays connected. Thanks, Chad -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: MYSQL Quota
Alex, Mysql does not do quota for users (atleast as far as I know). But I read once in sysadmin mag that an programmer at an isp wrote a mysql quota daemon. The article is not on the web but here is the issue: http://www.sysadminmag.com/articles/2002/0202/ There is a link on the left hand side uder magazine called back issues that offers you the option to order back issues of sysadmin magazine. https://www.sdmediagroup.com/samag/back_issue.htm Hope this helps, chad On Thu, 22 Aug 2002 14:08:01 +0300 Victoria Reznichenko <[EMAIL PROTECTED]> wrote: > Alex, > Thursday, August 22, 2002, 4:54:01 AM, you wrote: > > AJ> We want to set quota per user. Is that possible on MySQL ? If so > AJ> how can that be done? > > Depends on what you want to limit per user. Some info you can find > here: > http://www.mysql.com/doc/en/User_resources.html > > > > > -- > For technical support contracts, goto > https://order.mysql.com/?ref=ensita > This email is sponsored by Ensita.net http://www.ensita.net/ >__ ___ ___ __ > / |/ /_ __/ __/ __ \/ /Victoria Reznichenko > / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] > /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ><___/ www.mysql.com > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail > <[EMAIL PROTECTED]> Trouble > unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
replication questions
Hello everyone, The mysql documentation about replication is great at describing how to replicate fomr one master server. If i want to replicate many db servers to one replication server is there a way I can edit the my.cnf file to do this. Or would it be better to have another conf file for the other master running under another mysql instance?? Has anyone had any experience with this? What would be the best way to handle this? I am going to eventually replicate 10 masters on 1 db.. Thanks for the help... Sincerely, Chad - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
easy question
Hello, I am sure this is an easy question but I am not thinking clearly for some reason. :^) If you set a column to auto_Increment. You do not have to put the auto_increment # in the insert statement to get it to be inserted. Mysql does this automatically. Is there a way to have the timestamp automatically inserted when an insert statement is run? The timestamp of the insert statement. thanks for the help, chad -- Chad Kellerman - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Reseting auto_incremented id's
Hello everyone, I have a perl script that talks to a mysql database. What I am doing is grabbing a bunch of users of a server and putting them into a table. Then as the script runs on each user I am giving the status of the script as associated with the user. For example user abc will have a status running if the script is processing that particular user or finished when that user is done. The problem is, when I am done with all users in the table I want to remove them and "repopulate" the table with a new set of users froma different server. But when I remove the users and add the new users the auto_incremented id field does not get reset to 0, it picks off where the other users id left off. Is there any way to reset this id field to 0 when I am done processing the users? I read this can be accomplished by an myisamchk. But I do not want to have system calls thru my script? Is there any other way to do this? Thanks for the help -chad -- Chad Kellerman - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: query mysql db from a bash script?
Takacs, I think you can use mysql --execute= databasename you should be able to execute mysql command thru bash that way. chad On Tue, 19 Mar 2002 10:20:08 +0100 "Takacs Istvan" <[EMAIL PROTECTED]> wrote: > Hi > > Is that possible to query the database from a bash > script? > I need some informations from a table, and it looks > the easiest way. > How can I connect, use a database, and query > a table? > > Thanks in advance! > > Regards; > > Istvan > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: MySql on Solaris
Ahmed, Forget about it. I tried to do this, I tried for about two weeks, then got mad and downloaded the src and compile it mysql. It works great. -chad if you do get it working let me know On Thu, 07 Mar 2002 09:14:58 -0700 "Ahmed S K Anis" <[EMAIL PROTECTED]> wrote: > Hi members, > This is my first query :) > My query is about installing MySql on Solaris. > I am interested in downloading and installing the stable version of > MySql on solaris 2.6. > > I downloaded mysql-3.22.25-solaris7-x86.pkg.tgz and MySQL 3.23. > I tried to install the first one (used GNU tar) . I followed the > documentation and tried to install the binary. I had various problems. > when i ran mysql_install_db, it gives error thast user id mysql not > created. > "make install" is giving error saying mysql not intialized. > > Also when i tried with MySQL 3.23, i was unable to configure and > build. > I could succesfully download and install MySql for Windows 95, but > Solaris has given me a lot of problems. > > I request members to please send me a doc or explain the installation > of MySql on Solaris 2.6. > The link http://www.mysql.com/doc/S/o/Solaris_2.7.html does not help > me much as you can see. > I am interested in downloading and installing the binaries only. Please > help me to to get it up and running. > > In anticipation > > Best Regards, > Anis > > > > > > > > > > > > > > > > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: MySQL replication error
Luc, The problem is that in the replication somewhere an update was taken twice. Adjust the skip to according to the position of the duplicate entry. I have had to skip 100 before in order to get the slave started. First check the binary log and see how many insert statements after the error "path to mysql/bin/mysqlbinlog QBSLIXDB1-bin.log". There had to be a reason why the rep stop syncing ( did you run a myisam check on the master and it removed something??). Check the log to see what transaction failed or duplicated itself. Normally you can skip that transaction on the slave and start up the slave. But if therea are other transaction out of sync after the first failed transaction you will have to keep skipping the transactions. Until the slave kicks up. It kinda hard to tell with out seeing the binary log file as to how many you have to skip or even which one to skip. But as soon as you hit the duplicate transaction witht he skip, the slave will start. Let me know the scoop... -chad On Fri, 22 Feb 2002 11:29:41 -0500 Luc Foisy <[EMAIL PROTECTED]> wrote: > > Chad, this did not work. Though it did do something, the Position jumped > ahead > > mysql> show slave status\G > *** 1. row *** > Master_Host: 209.217.92.34 > Master_User: repslave2 > Master_Port: 3306 > Connect_retry: 60 >Log_File: QBSLXDB1-bin.029 > Pos: 2596608 > Slave_Running: No > Replicate_do_db: qbslive > Replicate_ignore_db: > Last_errno: 1062 > Last_error: error 'Duplicate entry '1376034' for key 1' on query > 'INSERT INTO DISPATCHLOG (CreateStamp) VALUES (NOW())' >Skip_counter: 1 > 1 row in set (0.00 sec) > > mysql> set sql_slave_skip_counter = 1; > Query OK, 0 rows affected (0.01 sec) > > mysql> slave start; > Query OK, 0 rows affected (0.00 sec) > > mysql> show slave status\G > *** 1. row *** > Master_Host: 209.217.92.34 > Master_User: repslave2 > Master_Port: 3306 > Connect_retry: 60 >Log_File: QBSLXDB1-bin.029 > Pos: 2596630 > Slave_Running: No > Replicate_do_db: qbslive > Replicate_ignore_db: > Last_errno: 1062 > Last_error: error 'Duplicate entry '1376034' for key 1' on query > 'INSERT INTO DISPATCHLOG (CreateStamp) VALUES (NOW())' >Skip_counter: 0 > 1 row in set (0.00 sec) > > > -Original Message- > From: chad kellerman [mailto:[EMAIL PROTECTED]] > Sent: Thursday, February 21, 2002 5:18 PM > To: Luc Foisy > Cc: [EMAIL PROTECTED] > Subject: Re: MySQL replication error > > > > Luc, > > I new to this mailinglist ( this is my first posting) But I have worked a > little with replication. > > Try if the replicator is still down. > > set sql_slave_skip_counter = 1; slave start > > on the slave as long as you are sure the master is ok. > > Let me know is this worked. > > -chad > > > > On Thu, 21 Feb 2002 15:48:08 -0500 > Luc Foisy <[EMAIL PROTECTED]> wrote: > > > Would anyone be able to tell me why this happened, and how I could fix it? > > > > mysql> show slave status\G > > *** 1. row *** > > Master_Host: 209.217.92.34 > > Master_User: repslave2 > > Master_Port: 3306 > > Connect_retry: 60 > >Log_File: QBSLXDB1-bin.029 > > Pos: 2596608 > > Slave_Running: No > > Replicate_do_db: qbslive > > Replicate_ignore_db: > > Last_errno: 1062 > > Last_error: error 'Duplicate entry '1376034' for key 1' on query > > 'INSERT INTO DISPATCHLOG (CreateStamp) VALUES (NOW())' > >Skip_counter: 0 > > > > err_log > > 020221 14:21:12 mysqld started > > /usr/local/libexec/mysqld: ready for connections > > 020221 14:21:14 Slave: connected to master > '[EMAIL PROTECTED]:3306', > > replication started in log 'QBSLXDB1-bin.029' at position > > 2596608 > > ERROR: 1062 Duplicate entry '1376034' for key 1 > > 020221 14:21:14 Slave: error running query 'INSERT INTO DISPATCHLOG > > (CreateStamp) VALUES (NOW())' > > 020221 14:21:14 Error running query, slave aborted. Fix the problem, and > > re-start the slave thread with "mysqladmin start-slave". We s > > topped at log 'QBSLXDB1-b
Re: MysqlReplication
It can be done. The slave server needs to hold mutiple slave databases corresponding to the masters. Each slave instance needs to be start separately. For example, each database wil need it's own my.cnf file holding with port the master is connecting to. I have seen this done with full databases, I am not to sure about selecting tables from MAsters to replicate hope that helps. -chad On Fri, 22 Feb 2002 15:20:52 +0100 [EMAIL PROTECTED] wrote: > query > Is it possible to set one SLAVE to handle two or multiple MASTERS??? > For example if I want to replicate one table from one MASTER and > second table from another. > > Thanx a lot > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: MySQL replication error
Luc, I new to this mailinglist ( this is my first posting) But I have worked a little with replication. Try if the replicator is still down. set sql_slave_skip_counter = 1; slave start on the slave as long as you are sure the master is ok. Let me know is this worked. -chad On Thu, 21 Feb 2002 15:48:08 -0500 Luc Foisy <[EMAIL PROTECTED]> wrote: > Would anyone be able to tell me why this happened, and how I could fix it? > > mysql> show slave status\G > *** 1. row *** > Master_Host: 209.217.92.34 > Master_User: repslave2 > Master_Port: 3306 > Connect_retry: 60 >Log_File: QBSLXDB1-bin.029 > Pos: 2596608 > Slave_Running: No > Replicate_do_db: qbslive > Replicate_ignore_db: > Last_errno: 1062 > Last_error: error 'Duplicate entry '1376034' for key 1' on query > 'INSERT INTO DISPATCHLOG (CreateStamp) VALUES (NOW())' >Skip_counter: 0 > > err_log > 020221 14:21:12 mysqld started > /usr/local/libexec/mysqld: ready for connections > 020221 14:21:14 Slave: connected to master '[EMAIL PROTECTED]:3306', > replication started in log 'QBSLXDB1-bin.029' at position > 2596608 > ERROR: 1062 Duplicate entry '1376034' for key 1 > 020221 14:21:14 Slave: error running query 'INSERT INTO DISPATCHLOG > (CreateStamp) VALUES (NOW())' > 020221 14:21:14 Error running query, slave aborted. Fix the problem, and > re-start the slave thread with "mysqladmin start-slave". We s > topped at log 'QBSLXDB1-bin.029' position 2596608 > 020221 14:21:14 Slave thread exiting, replication stopped in log > 'QBSLXDB1-bin.029' at position 2596608 > > > Luc Foisy > > Technical Magic - www.technical-magic.com > 1 Stafford Road, Suite 325, Nepean, Ontario, K2H 1B9 > Phone: (613) 829-7117 Fax: (613) 596-5096 > E-Mail: [EMAIL PROTECTED] > > < Fulfilling the Promise of Technology > > > > - > Before posting, please check: >http://www.mysql.com/manual.php (the manual) >http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <[EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php