Sponsored Content
Top Forums Shell Programming and Scripting mysql script in a command shell Post 302547900 by mduduzi on Wednesday 17th of August 2011 03:16:57 AM
Old 08-17-2011
thank u "crimso" i managed to creat my database. Now when i try to create the tables i get the following error "ERROR 1136 (21S01) at line 7: Column count doesn't match value count at row 1" and the error refers to this line "name VARCHAR(100), surname VARCHAR(100), dob DATE, age VARCHAR (10),
PRIMARY KEY (id)" i`m also trying to work around this issue. Pls assist

---------- Post updated at 05:16 AM ---------- Previous update was at 03:07 AM ----------
Code:
#!/bin/bash

echo "Enter name"
read name
echo "Enter surname"
read surname
echo "Enter dob"
read dob (i`m not sure if this is the issue cause it keeps on referring to this line)
echo "Enter age"
read age

mysql -hlocalhost -uroot -p -D durban << EOF
#create database durban;
use durban;
#CREATE TABLE soweto (
#id INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
#name VARCHAR(100), surname VARCHAR(100), dob DATE, age INTERGER (10),
#PRIMARY KEY (id)
#);
INSERT into soweto VALUES ('$name','$surname','$dob','$age');
quit;
EOF

eish now i`m getting the following error "ERROR 1136 (21S01) at line 8: Column count doesn't match value count at row 1"

Last edited by Scott; 08-17-2011 at 08:05 AM.. Reason: Please use code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Mysql with shell script

Hi did any books teaching beginner to run mysql using BASH shell? thkx (5 Replies)
Discussion started by: lijiajin
5 Replies

2. Shell Programming and Scripting

executing mysql load statement from shell script

Hi, I have a piece of shell script which will connect to mysql database and execute a load statement(which will load datas in a file to the database table).The code is working and the data is in the tables. Now my requirement is, i need to grab the output from the load statement... (4 Replies)
Discussion started by: DILEEP410
4 Replies

3. Shell Programming and Scripting

Multiple MySql queries in shell script?

Hi guys, i know how to run a single query using mysql embedded in a shell script as follows: `mysql -umyuser -pmypass --host myhost database<<SQL ${query}; quit SQL` However, how would i be able to run several queries within the same connection? The reason for this is i am creating... (3 Replies)
Discussion started by: muay_tb
3 Replies

4. Shell Programming and Scripting

Passing a variable from shell script to mysql query?

I heard this was possible but from my research I haven't been able to figure it out yet. Seems it should be simple enough. Basically from a high level view I'm trying to accomplish... . $X='grep foo blah.log' then 'mysql command SELECT foo FROM bar WHERE ' . $X or something like that. ... (2 Replies)
Discussion started by: kero
2 Replies

5. Shell Programming and Scripting

while puting shell variable in mysql command value does not interpolate

port=$(ssh tms6@$x cat /tms6/scripts/start.lc.sh | grep -P '^\/tms6\/bin\/lc' | cut -d' ' -f3 | cut -b 3-6) tpsip=$(ssh tms6@$x cat /tms6/scripts/start.lc.sh | grep -P '^\/tms6\/bin\/lc' | cut -d' ' -f4 | cut -b 9-) # IFS="\n" set -- $port ... (1 Reply)
Discussion started by: rrd1986
1 Replies

6. Shell Programming and Scripting

Mysql command after a SSH connection (Script)

Hi all, Im new at scripting and i need to run a few commands at work every hours so i decide to make a script but on 1 of the steps i have a the follwoing problem: The command i do is this: #!/bin/bash ssh root@asdasd001 'mysql -h A-db-1 -uroot -password --execute "show slave status"'... (3 Replies)
Discussion started by: Aparicio
3 Replies

7. Shell Programming and Scripting

Using a shell script variable in a mysql query using 'LIKE'

Hello. I am writing a simple script that reads a text file and removes records from a mysql database. The items in the text file are of the format: firstname.middle.lastXXX, where XXX is a 3 digit number. The table has an email field that will match the firstname.middle.last. So, I thought I... (1 Reply)
Discussion started by: bricoleur
1 Replies

8. Shell Programming and Scripting

mysql script in a command shell

Hi i`m trying this script to run and i get the following error. Enter your name tman Enter your surname smith -bash: ./500: line 20: unexpected EOF while looking for matching `"' -bash: ./500: line 21: syntax error: unexpected end of file ... (2 Replies)
Discussion started by: mduduzi
2 Replies

9. Shell Programming and Scripting

Shell script - Download - Mysql replace

Hi, I have a video script. it has embedded Youtube videos. I want replace them downloaded version mp4 videos. this script has a mysql table. I want search "url_flv" field on table a youtube link if has a youtube link I want download it this command. I want extract uniq_id field for file... (2 Replies)
Discussion started by: tara123
2 Replies

10. Shell Programming and Scripting

Mysql is not working in shell script

Hi Team, I have created attached script in mysql environment. But there is below error . can you please suggest . Error : Unknown table 'processlist' in finformation_schema #!/bin/bash mysql -u $DBUSER -p$DBPASS -e " select -- * id from information_schema.processlist where... (1 Reply)
Discussion started by: Jewel
1 Replies
QAsciiDictIterator(3qt) 												   QAsciiDictIterator(3qt)

NAME
QAsciiDictIterator - Iterator for QAsciiDict collections SYNOPSIS
#include <qasciidict.h> Public Members QAsciiDictIterator ( const QAsciiDict<type> & dict ) ~QAsciiDictIterator () uint count () const bool isEmpty () const type * toFirst () operator type * () const type * current () const const char * currentKey () const type * operator() () type * operator++ () type * operator+= ( uint jump ) DESCRIPTION
The QAsciiDictIterator class provides an iterator for QAsciiDict collections. QAsciiDictIterator is implemented as a template class. Define a template instance QAsciiDictIterator<X> to create a dictionary iterator that operates on QAsciiDict<X> (dictionary of X*). Example: QAsciiDict<QLineEdit> fields; fields.insert( "forename", new QLineEdit( this ) ); fields.insert( "surname", new QLineEdit( this ) ); fields.insert( "age", new QLineEdit( this ) ); fields["forename"]->setText( "Homer" ); fields["surname"]->setText( "Simpson" ); fields["age"]->setText( "45" ); QAsciiDictIterator<QLineEdit> it( fields ); for( ; it.current(); ++it ) cout << it.currentKey() << ": " << it.current()->text() << endl; cout << endl; // Output (random order): // age: 45 // surname: Simpson // forename: Homer In the example we insert some line edits into a dictionary, then iterate over the dictionary printing the strings associated with those line edits. Note that the traversal order is arbitrary; you are not guaranteed any particular order. Multiple iterators may independently traverse the same dictionary. A QAsciiDict knows about all the iterators that are operating on the dictionary. When an item is removed from the dictionary, QAsciiDict updates all the iterators that are referring to the removed item to point to the next item in the (arbitrary) traversal order. See also QAsciiDict, Collection Classes, and Non-GUI Classes. MEMBER FUNCTION DOCUMENTATION
QAsciiDictIterator::QAsciiDictIterator ( const QAsciiDict<type> & dict ) Constructs an iterator for dict. The current iterator item is set to point on the first item in the dict. QAsciiDictIterator::~QAsciiDictIterator () Destroys the iterator. uint QAsciiDictIterator::count () const Returns the number of items in the dictionary this iterator operates over. See also isEmpty(). type * QAsciiDictIterator::current () const Returns a pointer to the current iterator item. const char * QAsciiDictIterator::currentKey () const Returns a pointer to the key for the current iterator item. bool QAsciiDictIterator::isEmpty () const Returns TRUE if the dictionary is empty, i.e. count() == 0, otherwise returns FALSE. See also count(). QAsciiDictIterator::operator type * () const Cast operator. Returns a pointer to the current iterator item. Same as current(). type * QAsciiDictIterator::operator() () Makes the succeeding item current and returns the original current item. If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned. type * QAsciiDictIterator::operator++ () Prefix ++ makes the succeeding item current and returns the new current item. If the current iterator item was the last item in the dictionary or if it was 0, 0 is returned. type * QAsciiDictIterator::operator+= ( uint jump ) Sets the current item to the item jump positions after the current item, and returns a pointer to that item. If that item is beyond the last item or if the dictionary is empty, it sets the current item to 0 and returns 0. type * QAsciiDictIterator::toFirst () Sets the current iterator item to point to the first item in the dictionary and returns a pointer to the item. If the dictionary is empty it sets the current item to 0 and returns 0. SEE ALSO
http://doc.trolltech.com/qasciidictiterator.html http://www.trolltech.com/faq/tech.html COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement. AUTHOR
Generated automatically from the source code. BUGS
If you find a bug in Qt, please report it as described in http://doc.trolltech.com/bughowto.html. Good bug reports help us to help you. Thank you. The definitive Qt documentation is provided in HTML format; it is located at $QTDIR/doc/html and can be read using Qt Assistant or with a web browser. This man page is provided as a convenience for those users who prefer man pages, although this format is not officially supported by Trolltech. If you find errors in this manual page, please report them to qt-bugs@trolltech.com. Please include the name of the manual page (qasciidictiterator.3qt) and the Qt version (3.3.8). Trolltech AS 2 February 2007 QAsciiDictIterator(3qt)
All times are GMT -4. The time now is 03:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy