Re: mysqldump
Try removing the space between -p and password. i.e., like this: mysqldump databasename -u username -ppassword >/to/a/directory/dump.sql > Hello > > I'm trying to make mysqldump in a shell script but I can't deliver > password to sql server. > > I have command in the script: > > mysqldump databasename -u username -p password > > /to/a/directory/dump.sql > > When i run the script it asks for a password and takes the password > given in the script for a table name. > > How can I give the password in the script??? > > mysqldump --help wasn't wery helpful... > > -Kalle > > Thanks > > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Upgrading MySQL on RedHat 9
I am getting ready to try to upgrade MySQL on my RedHat 9 box. I want to go from the version that came with the distro (version 3.23.54) to the latest (verion 4.0). Just thought I'd post to get a heads-up on any known issues or prerequisites. I just hate it when I try something like this and screw up my whole installation. My planned steps are to: 1. mysqldump everything to a backup file 2. stop the service 3. uninstall all the current rpm's 4. install the fresh rpm's 5. startup 6. \. the file from step 1 Anything I need to lookout for? Thanks. Andrew -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Insert statement with an ' in it
Well, the easiest thing is to "escape" any single quotes with a backslash character (\). PHP includes a function named addslashes() that does this. http://us4.php.net/manual/en/function.addslashes.php Same logic applies in other languages. Hope this helps. Andrew > Help! I'm trying to do an insert statement where one of the fields > sometimes contains an apostrophe. The field type is a varchar. Everytime > that one of these values comes up with an apostrophe, it tells me there > is an error in my SQL statement (obviously because it thinks there are > more information than there are fields I'm inserting into) > > I'm sure this is something simple, but I can't seem to find the answer > on the web. Please help! > > -Zach -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Compiling with the C API
I have a question regarding compiling a C program with the mysql C api. >From the documentation, the only way I really see explained for compiling is a shell script that looks like this: CFG=/usr/bin/mysql_config sh -c "gcc -o $1 `$CFG --cflags` $1.c `$CFG --libs`" This works great when all my source code is in one file. However, I need to modularize things and do separate compile and link steps. When I do this, sh -c "gcc -o $1 `$CFG --cflags` $1.c" It complains that it cannot find the header file for mysql.h. This does not make sense to me. Also, I do not understand why I need to do the sh -c. Why can I not just do the gcc part here? I really want to build a makefile but I am just trying to take baby steps here (I am new to Linux programming). Thanks. Andrew -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Data types and the C API
Thanks Paul. After looking a little more closely at the documentation I figured this out. The example there looks like this: num_fields = mysql_num_fields(result); while((row = mysql_fetch_row(result))) { unsigned long *lengths; lengths = mysql_fetch_lengths(result); for(i = 0; i < num_fields; i++) { printf("%.*s] ", (int) lengths[i], row[i] ? row[i] : "NULL"); } printf("\n"); } While this does not explicitely say that all columns are returned as null-terminated strings, it is implied in the printf statement. Thanks for you quick reply. Andrew > At 20:37 -0400 6/18/03, Andrew Pierce wrote: >>I am trying to learn to use the C API for MySQL and have a question. I >> have a table that has a primary key defined as int(11). I don't know >> what data type this translates to in C. I thought maybe an unsigned int >> or an unsigned long. I have this little loop that cycles through the >> results of a query and displays the first two columns, the first being >> the int(11) and the second a varchar. Here is the code: >> >>result = mysql_use_result(&mysql); >>while((row = mysql_fetch_row(result))) { >> printf("%lu %s\n", row[0], row[1]); >>} >> >>The first column is printed as garbage while the second column shows >> the data correctly. > > INT in MySQL is a 4-byte data type, but that's on the server side. The > result that you're observing is that all values are returned to the > *client* as strings. So you can either print the string using %s, or > convert it to a C int and use %ld (you don't say that your MySQL type is > UNSIGNED, so I'm assuming %ld rather than %lu). > > The MySQL 4.1 client/server protocol has some features that allow you to > get back values in binary form without the conversion to string, but > you're probably not using that. > >> >>Help? >> >>Thanks. >> >>Andrew >> >> >> >>-- >>MySQL General Mailing List >>For list archives: http://lists.mysql.com/mysql >>To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] > > > -- > Paul DuBois, Senior Technical Writer > Madison, Wisconsin, USA > MySQL AB, www.mysql.com > > Are you MySQL certified? http://www.mysql.com/certification/ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Data types and the C API
I am trying to learn to use the C API for MySQL and have a question. I have a table that has a primary key defined as int(11). I don't know what data type this translates to in C. I thought maybe an unsigned int or an unsigned long. I have this little loop that cycles through the results of a query and displays the first two columns, the first being the int(11) and the second a varchar. Here is the code: result = mysql_use_result(&mysql); while((row = mysql_fetch_row(result))) { printf("%lu %s\n", row[0], row[1]); } The first column is printed as garbage while the second column shows the data correctly. Help? Thanks. Andrew -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: GRANT not working
I believe my problem was that I was omitting the word PRIVILEGES. I was doing just GRANT ALL ON... I also added *.* instead of * and @'localhost' and that got it working. Thanks to all who helped out. Andrew > I personally have never had a problem with Redhat. > > Andrew try this: > > grant all privileges on *.* > to 'amp'@'%' > identified by 'blah' > (with grant option) > ; > > let me know if it works. > > ----- Original Message - > From: "Matt Hargraves" <[EMAIL PROTECTED]> > To: "Andrew Pierce" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Tuesday, September 03, 2002 7:22 PM > Subject: Re: GRANT not working > > > I believe that your problem is specifically with RedHat. I've ran it on > just about every incarnation of Linux from Mandrake to Gentoo. The only > one that I have ever had a problem getting MySQL to run on was RedHat > 7.x and I've even run it on things like OpenMosix (www.openmosix.org) > and Scyld. Tried RedHat versions from 7.0 to 7.3, none of them will run, > install any other distro, it works from the start. Don't matter whether > it's MySQL 3.x or 4.x, it won't work for me or anyone else I know with > RedHat. > > Hope that helps you with your problem. > > Matt > > - Original Message - > From: "Andrew Pierce" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, September 03, 2002 7:06 AM > Subject: GRANT not working > > >> I have a new installation of RedHat 7.3 and MySql. I had MySql working >> great on a Mandrake 8.0 installation. Now that I have reloaded this >> box with RH, I cannot get setup and working. >> >> I can run mysql as root and get in. I ran the commands below: >> >> >grant all on * to amp identified by 'blahdblah'; >> >flush privileges; >> >> Now when I run mysql like this: >> >> $mysql -u amp -pblahdblah >> >> I get the following error: >> >> ERROR 1045: Access denied for user: 'amp@localhost' (Using password: >> YES) >> >> I have a sneaking suspicion about the host but I don't know how to fix >> it. >> >> Thanks for any help. >> >> Andrew >> >> >> >> >> - >> 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 > > > - > 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
GRANT not working
I have a new installation of RedHat 7.3 and MySql. I had MySql working great on a Mandrake 8.0 installation. Now that I have reloaded this box with RH, I cannot get setup and working. I can run mysql as root and get in. I ran the commands below: >grant all on * to amp identified by 'blahdblah'; >flush privileges; Now when I run mysql like this: $mysql -u amp -pblahdblah I get the following error: ERROR 1045: Access denied for user: 'amp@localhost' (Using password: YES) I have a sneaking suspicion about the host but I don't know how to fix it. Thanks for any help. Andrew - 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