Put together (Merge) two tables in one

2001-07-20 Thread Martin Cabrera Diaubalick

Hello everyone,

I have two tables each with 12K records, I need to merge them into one single table 
and also check for duplicates. I'm thinking in doing it with PHP and Mysql. My idea 
involves one SELECT query and almost 12K insert query. Is there a faster way of doing 
using only MySQL?

Thanks in advance
Regards

-
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




Anyone knows what's wrong with this INSERT sentence?

2001-07-20 Thread Martin Cabrera Diaubalick

Hello all,

I have this two tables : table1,table2 . I would like to include all emails from 
table2 into table1 removing duplicates.
 
INSERT INTO table1 (email) SELECT  email from table2 where table1.email  
table2.email;

MYSQL says: ERROR 1109: Unknown table 'table1' in where clause

Both tables exist, what's wrong?

TIA

Regards



-
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




Is it possible? ODBC doubt.

2001-05-16 Thread Martin Cabrera Diaubalick

Hi there!

I installed MyODBC and tried to import a Database from my Web Hosting
account but didn't let me. Was it me that didn't know how to do it or is it
possible that access is only allowed through local connection?


TIA
Regards



-
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: saving database during os changeover

2001-05-09 Thread Martin Cabrera Diaubalick

Hi Kris!

mysqldump is your command

Check this URL: http://www.faqts.com/knowledge_base/view.phtml/aid/1990

HTH
Regards

- Original Message -
From: Kris Gonzalez [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 09, 2001 10:19 AM
Subject: saving database during os changeover


 I'm going to be switching from my OS from Linux to Solaris and was
 wondering what steps I would need to take to save my tables during the
 OS conversion and restore them once it is complete.  Is it as simple as
 tarballing the /var/lib/mysql directory and extracting it into the new
 OS, or is the procedure more complicated?

 Any insight you can provide would be much appreciated.  Thanks in
 advance!

 -kg

 -
 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




Part two: Help restarting mysqld!! System crashes randomly :-(

2001-04-20 Thread Martin Cabrera Diaubalick

Hello again!

Thanks to everyone that helped me yesterday with the MySQL crash and how to
restart the server. But now I have another problem, the MySQL 3.22.32 server
is crashing every now and then.
Looking at the .err file, it says

010420  1:48:51  Warning: setrlimit couldn't increase number of open files
to more than 164
010420  1:48:51  Warning: Changed limits: max_connections: 30  table_cache:
62


Looking through Google.com I found this answer :

* BEGINNING OF ANSWER


 Can someone explain what these 2 mysql errors are?  I found them in an
.err
 file in my mysql directory.  I searched the Mysql website and looked
 through my book and couldn't find anything.  They are kinda self
 explanatory, but why are they appearing?

 000725 17:34:12 Warning: setrlimit couldn't increase number of open files
 to more than 164
 000725 17:34:12 Warning: Changed limits: max_connections: 30 table_cache:
62

According to my O'Reilly book - mySQL and mSQL (page 63) You might need to
increase
the max_connections and table_cache settings when mySQL starts.

* END OF ANSWER



Is this right? Do I have to increase these values? How much?
But the most important thing, in what file do I have to apply all these
changes?

An one last thing, I found these lines commented in safe_mysqld, The Site is
running FreeBSD 4.2.
Should I un-comment these lines?



* LINES OF safe_mysqld
*

# Does this work on all systems?
#if type ulimit | grep "shell builtin"  /dev/null
#then
#  ulimit -n 256  /dev/null 21  # Fix for BSD and FreeBSD systems
#fi

* END LINES OF safe_mysqld
*


Thanks again in advance, and sorry for the mail length. I'm just a little
desperate with this :-)



-
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




Help restarting mysqld !!

2001-04-19 Thread Martin Cabrera Diaubalick

Hello everyone! This is the first time I post here, so please bear with me.

It all started when I deleted a whole table by mistake. So I try to
recovered it by copying yesterday's backup. I had never done that before and
it all worked wrong. I found out MySQL server had to be restarted in order
to changes take effect.

I kill mysqld daemon with a 'kill PID', but I didn't know how to restart  it
.I tried with a 'mysqld'  but as soon as I close the Terminal Window, mysqld
died.
Then I tried with 'mysqld ' and it crashed after a while.
Finally I found this nice little script below, I executed it but due to my
ignorance I don't if what I did is right. Everything seems to be ok right
now but I'm not sure if it's gonna crash in a while.

Could you please take a look at it and tell me what you think.


Thanks in advance

Regards

MySQL version: 3.22.32
OS: FreeBSD 4.2






***   Beginning of safe_mysqld


#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB  Monty Program KB  Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
#
# scripts to start the MySQL daemon and restart it if it dies unexpectedly
#
# This should be executed in the MySQL base directory if you are using a
# binary installation that has other paths than you are using.
#
# mysql.server works by first doing a cd to the base directory and from
there
# executing safe_mysqld

trap '' 1 2 3 15   # we shouldn't let anyone kill us

# Check if we are starting this relative (for the binary release)
if test -d ./data/mysql -a -f ./share/mysql/english/errmsg.sys -a \
 -x ./bin/mysqld
then
  MY_BASEDIR_VERSION=`pwd`  # Where bin, share and data are
  DATADIR=$MY_BASEDIR_VERSION/data # Where the databases are
  ledir=$MY_BASEDIR_VERSION/bin  # Where mysqld is
# Check if this is a 'moved install directory'
elif test -f ./var/mysql/db.frm -a -f ./share/mysql/english/errmsg.sys -a \
 -x ./libexec/mysqld
then
  MY_BASEDIR_VERSION=`pwd`  # Where libexec, share and var are
  DATADIR=$MY_BASEDIR_VERSION/var # Where the databases are
  ledir=$MY_BASEDIR_VERSION/libexec # Where mysqld is
else
  MY_BASEDIR_VERSION=/usr/home/notodo/usr/local/mysql
  DATADIR=/usr/home/notodo/usr/local/mysql/var
  ledir=/usr/local/bin/
  if test ! -x $ledir/mysqld
  then
echo "The file $ledir/mysqld doesn't exist or is not executable"
echo "Please do a cd to the mysql installation directory and restart"
echo "this script from there as follows:"
echo "./bin/safe_mysqld".
exit 1;
  fi
fi

pid_file=$DATADIR/`/bin/hostname`.pid
log=$DATADIR/`/bin/hostname`.log
err_log=$DATADIR/`/bin/hostname`.err

# Parse arguments to see if caller wants the pid_file somewhere else.
for arg
do
  case $arg
in
--pid-file=*)
  pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"`
  ;;
--datadir=*)
  DATADIR=`echo "$arg" | sed -e "s;--datadir=;;"`
  ;;
  esac
done

#
# If there exists an old pid file, check if the daemon is already running
# Note: The switches to 'ps' may depend on your operating system

if test -f $pid_file
then
  PID=`cat $pid_file`
  if /bin/kill -0 $PID
  then
if /bin/ps p $PID | grep mysqld  /dev/null
then# The pid contains a mysqld process
  echo "A mysqld process already exists"
  echo "A mysqld process already exists at " `date`  $err_log
  exit 1;
fi
  fi
  rm -f $pid_file
  if test -f $pid_file
  then
echo "Fatal error: Can't remove the pid file: $pid_file"
echo "Fatal error: Can't remove the pid file: $pid_file at " `date` 
$err_log
echo "Please remove it manually and start $0 again"
echo "mysqld daemon not started"
exit 1;
  fi
fi

#
# Uncomment the following lines if you want all tables to be automaticly
# checked and repaired at start
#
# echo "Checking tables in $DATADIR"
# isamchk --silent --force $DATADIR/*.ISM

echo "Starting mysqld daemon with databases from $DATADIR"

#Default communication ports
#MYSQL_TCP_PORT=3306
if test -z "$MYSQL_UNIX_PORT"
then
  MYSQL_UNIX_PORT="/tmp/mysql.sock"
  export MYSQL_UNIX_PORT
fi
#export MYSQL_TCP_PORT

# Does this work on all systems?
#if type ulimit | grep "shell builtin"  /dev/null
#then
#  ulimit -n 256  /dev/null 21  # Fix for BSD and FreeBSD systems
#fi

echo "mysqld started on " `date`  $err_log
while true
do
  rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety
  if test "$#" -eq 0
  then
nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
   $err_log 21
  else
nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \
  "$@"  $err_log 21
  fi
  if test ! -f $pid_file  # This is removed if normal shutdown
  then
break;
  fi
  if false
  then
# Test if one process was hanging.
# This is only a fix for Linux (running as base 3 mysqld processes)
# but should work for the rest of the servers.
# The only thing is ps x = redhat 5 gives warnings when using ps -x.
# kill -9 is used or