Running Sql File From Shell Script
When i run the command "mysql -h host - u user - p password -D database <file.sql" (the file.sql contains an Update Scrpit) from command prompt
/usr/test> mysql -h host - u user - p password -D database <file.sql
i am able to run the file and i am getting expected results.
When i copy the same string in a shell script (suppose in update.sh) and try running it from the command prompt
/usr/test> . update.sh
i get an error as "No file or directory found"
i tried giving in the full path of file.sql and tried running hte shell script but it gave me the same results "No file or directory found".
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Running Mysql From Shell
I need to run this sort of querys from shell: delete from 3dinformatica where preco = " " ; CREATE TABLE tudotest AS SELECT DISTINCT * FROM 3dinformatica; DELETE FROM 3dinformatica; INSERT INTO 3dinformatica (cr_datetime,produto,vendedor,preco,link) SELECT DISTINCT cr_datetime,produto,vendedor,preco,link FROM tudotest; DROP TABLE tudotest; i wanted to put the mysql cmd in a file like mysql.sh and run it from crontab. i have about 100 querys like that i need to run at the same time.
Running An Existing SQL File
I hope this question is not too 'newbie' to answer.. I'm reading a book (PHP and MySQL web development by Luke Welling and Laura Thomson), and am getting an error on an example script. I'm trying to create tables using an existing SQL file through MySQL. According to the book, it should be done like this: > mysql -h hostname -u username -D database -p < file.sql (I've changed the hostname, username, etc.) However, I get the same error over and over again: ERROR 1064 (42000): ... at line 1. The book didn't even mention where to put the file, I've tried all sorts of things, but can't get it to work..
Running Script File
I want to write mysql code like create table ... and insert into ... in text file and run the codes in mysql. I have installed mysql in my machine windows xp. and the help says the mysql> source (filename) will work to run the code file. but it does no work. says could not open the file. I am not sure where should i put my code file and the extension of the file required.
Running MySQL Using A Dos Batch File
I am used to use MySQL on Unix, now I have to do some development for MySQL running on Windows machine. The following script works well in Unix but I am unable to run it on Windows. "MY_FLAG" is the one which is causing issue. Due to certain restriction in my framework, I can use the normal batch by supplying the .sql file while opening the mysql connection ( infact i need to run multiple source files) Code:
Running Mysql Code Within A Php File?
I have been given a some mysql code that I have to run within a website - I am familiar with mysql in terms of insert info and querying a database but I at a loss as to how to make this work. the mysql code works in mysqladmin, but how do I call it into my php code? BTW the mysql code creates a new record in the database ....... Also, I need to tweak the code so it runs in a loop for different variables - in php I would run a FOREACH query, how do I do it in mysql?
Running External .sql Text File
I have a database on a sever that is running some version of MySQL 4. I wan't to put the same database on my local computer. I ran a MySQL dump from the server and tried to run the resulting text file from the UNIX command line on my computer (Running MySQL 5 on Mac OS 10.4). I always get error 1064: CODEERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' CREATE TABLE 'art_type' ( 'art_type_id' tinyint(11) unsigned NOT NULL auto' at line 1
Running Mysql Commands In A Batch File
I am trying to automate a mysql command to upload data everymorning on a windows server. I have created a .bat file and entered the commands to login to mysql but when it gets to the mysql prompt it fails to complete the rest of the commands. cd c: cdmysqlin mysql TRUNCATE TABLE blah LOAD DATA INFILE 'blah.txt' INTO blah QUIT exit Is this possible?
Running Existing .sql File In Mysql Command Prompt?
I've seen "examples" of this in my book on MySQL, but it just shows the file on the prompt. It says that I can run an existing sql file - for creating a table - right from the prompt. However, it doesn't really explain how to do this in detail. I've tried : -h host - u user -D database -p < myfile.sql but it gives an error. How do I point it to the right file on my system?
Log Into MySQL Via Shell?
i can't figure out how to log into mysql via the shell. I am using Microsoft Windows 2000 SP4, so I would guess that I have to use the CMD... but I can't figure it out. I have the 'root' user setup and a password set on it... and i know how to control my databases and create tables and modify them and everything in PHP... but i want to know how in the shell so I don't have to create a new php page and execute it every time.
Shell And Mysql
I am trying to run a mysql batch script through the shell. The one problem though is that the error messages out of my script dont go to the redirect i.e., if I run mysql<test.sql>test.log the error messages do no print into test.log, but to the command line. I would like to capture the errors into this log file as well. Any ideas?
Shell And Sql Dump
Does anyone know where I can find information on how to setup my shell in unix/linux to allow me to restore a database from an sql dump... I have a database on 83200.mysql.com (example) that I have a file mysql.sql (also just an example). The file was produced using an sqldump command from a web interface... How can I configure a connection if I am not on 83200.mysql.com so that I can import the data into a database with a name of database_wordpress
Access Mysql Via Shell
I am trying to run queries against a mysql DB, for which I've been provided a uid & pwd, but for this I first have to login as: CODEmysql -u xx -p password: xxxx use dbName; query
Linux Korn Shell 93
I have several korn shell scripts I use with a MySQL database on the same server (Solaris). I am moving to a Linux environment where the MySQL database is on another server. I would like to convert the database connection code to connect to the database on another Linux server. I see alot of information on Perl DBI CLI and PHP DBI CLI but cannot find any examples of Korn Shell connecting to a database on another server.Is there a way to accomplish a network connection to a MySQL database from Korn Shell?
Get Shell Throgh Mysql Db
i want to know if its pssosible to gets MS DOS access with MySQL Control Center or another remote control tool for mysql databank
Linux Shell Commands
in mysql database upon update on tables mysql should intimate to the OS process that a table got updated... how can we make it? is any ways to do that.... updation should trigger some C or C++ function?
Mysql Shell Startup Script
When starting up the mysql shell, is there a way that I can automatically run a startup-script ? Specifically, I would like to issue a BEGIN WORK everytime I open up the shell. I tried man mysql, but didn't get any the wiser.
Execute A Shell Command Inside SQL
I wonder if there is anyway you can run a shell command inside SQL. for example "SELECT * FROM table;execute shell command" I had googled around and didn't find anything.
Using Shell Script To Create Tables
I have several dozen tables to create and lots of them have a lot of fields. It is easy to create these tables using MyPHPAdmin or any other GUI tool but I want to make it even easier :|) I wrote this script: CODEmysql -u filepro -pfilePro -e "CREATE TABLE 'eglwms.jose2' ( 'field_01' VARCHAR(10), 'field_02' DECIMAL(9,2) DEFAULT '0.00' NOT NULL, 'field_03' VARCHAR(10) NOT NULL, 'field_04' VARCHAR(10) NOT NULL, 'field_05' VARCHAR(10), PRIMARY KEY ('field_03'), INDEX ('field_04'), UNIQUE ( 'field_01' ), ) COMMENT = 'Ocean Export BL';"
Import Data From Shell Script
I've a comma separated file and would like to use "LOAD DATA LOCAL INFILE..." inside a shell script to import data into a table. Basically, I want the script to connect to database, complete import using "LOAD DATA..." and exit. I understand, rows can be inserted one by one using database handles but I'd like this to be done using "LOAD DATA..." functionality.
Sql Database From Linux Fedora's Shell
How may I restore *.sql databases from linux shell? I've read the use of mysql command I don't have installed. This is a remote server with preinstalled Apache-php-mysql.
Mysql User With Shell Access
Is there any reason the mysql user account in a linux system would need shell access and a password? I thought it was just there to be a very underprivileged user and run the mysqld daemon.
Executing Shell Command From Mysql Query Browser
This works fine when executing the shell command inside the MYSQL in command line mysql> ! ls /home/www/htdocs/test 1000.xml class email test.xml test1.xml test2.xml But when i execute the same with dynamic SQL and executed in TOAD for MYSQL, it throws error SET @vSql:= '! ls /home/www/htdocs/test'; PREPARE vStmt FROM @vSql; EXECUTE vStmt; You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '! ls /home/www/htdocs/middleware/test' at line 1 Can some one clarify me Whether is that possible to execute the Shell commands from the query browser or it can be only used in the command line?
Extracting Field Data And Putting Each Field Into A Shell Variable?
In a MySQL query on the database (one table with 15 variable length fields, I want to put each field into a Bash variable so that I can handle each field as an entity. The query I have is something like this: mysql -e "use $database; select field1, field2, field3..., from Table1 where fieldN like '%something%';" can I / How do I do something like: mysql -e "use $database; select field1,..., var1=field1, var2=field2,....;" do stuff with var1, var2..., done
How Do I Upload A File To MySQL Database And View That File
I do not know how to upload a file to MySQL database and view the posting file on the webpage. I followed the code on-line that show me how to upload, but when I click "browse" to open my file in local drive and click "upload". Nothing happen ! How can I view it on the web page to make sure it was saved in data base.
Running Two SUM
SELECT SUM(nlamount WHERE nlaccount='3202' THEN 1 ELSE 0 END) AS receivables, SUM(nlamount WHERE nlaccount='3207' THEN 1 ELSE 0 END) AS receivablesvat FROM nominalledger WHERE nlcompanyid=$companyid AND nldate >= $company_end_year GROUP BY nlcompanyid I want to run this script, I basically want to add up nlamount twice, when nlaccount=3202 and nlaccount =3207 i have got te syntax wrong though in the SUM command, I have tried googling it, but there are only basic tutorials in sql outside the SUM instead of inside the SUM
Log-error File 'not Found' But This Same File Being Written To?!
I recently put up a message board and I get around 150+ hits a day so far. I've recently had some people sign up with my board but unfortunately, no one seems to be posting (they're just lurking around). I'm currently doing some promotions in the hope that others will post (like giving away a Lord of the Rings poster to all users who has 20 posts or more). Of course, my board has only been up for less than a month (3 weeks to be exact) so I know I need to be patient but I would appreciate any advice you can give me on how to turn lurkers into posters.
Help Please Running Mysql On Os X
I am very new to mysql. I am using the sitepoint book 'Build your own Database Driven Website using PHP and MYSQL. I have installed mysql mysql-5.0.41-osx10.3-powerpc. Under preferences/mysql it indicates that the mysql server is running. When I try to access mysql through the terminal window I get a message - command not found. Or no permissions. I can go to the bin directory and list the contents - they seem to be there. I can't get past page 21/22 Post-installation setup tasks. I am also new to using the terminal window. I suspect I have missed something really basic - any suggestions on how I can get up and running would be much appreciated!
Need Some Help In Getting MySQL Set Up And Running.
I wasn't sure if someone would be able and willing to help me, but I am new to installing MySQL on a Windows 2003 server (actually .. any server), but I am installing it on a Windows 2003 server right now. I also installed a new version of PHP on the same server. Everything looks fine, but when I go to phpinfo.php I don't see anything saying MySQL. (I saw somewhere that if MySQL is installed properly, it should be displayed on the phpinfo.php page.) I am currently trying to set up and run Cerberus Help Desk, but it isn't finding the MySQL database that I installed. So, I would really appreciate it if someone could not just help me via email or postings in here, but actually by using Instant Messenger (AOL, Yahoo! or MSN) to walk me through the set up, testing, etc. so I can get things up and running properly. I was hoping that someone with more experience than I might be willing to help me in this manner.
Is There A Way To Calculate Running SUM
I have a table (T1) consisting of 2 columns, Date and Observerd as follows: Date Observed 4/1/07 2 4/2/07 4 4/7/07 3 4/10/07 5 4/12/07 1 4/18/07 7 4/22/07 2 and we want to write a query to create a table or a view with the following data: Date ThreeDaySum 4/1/07 9 <-- (2+4+3) 4/2/07 12 <-- (4+3+5) 4/7/07 9 <-- (3+5+1) 4/10/07 13 <-- (5+1+7) 4/12/07 10 <-- (1+7+2)
Could Not Get MySQL Running
I went to MS-DOS to start the MySQL application by typing mysqld into the bin directory of where I installed MySQL but once I did typed the command and pressed enter this is all I got : A moment passed before I am shown the path of bin with no indication of MySQL server started. And also I have installed this as a window service.
Running Average
How can I get mysql to do a running average of a given field using dates from another column so that the average for each element is for a given time period rather than from the 5 rows next to the element?
#1064 - While Running A Doc Example
I plan to use the function ADDTIME(expr1, expr2) in an SQL request. I looked at the doc and tried the normal syntax, but I have always the following error even if I enter the example from the doc, why ? #1064 - You have an error in your SQL syntax. Even if I enter SELECT ADDTIME("1997-12-31 23:59:59.999999", "1 1:1:1.000002"); I am using MySQL under Windows 2000 using EasyPHP 1.7 (Apache 1.3.27, PHP 4.3.3, MySQL 4.0.15, PhpMyAdmin 2.5.3. )
Slow Running Sql
i am not using mysql but an unknown database system on a unix box - i have no control over the database but have purchased an odbc driver that seems very 'clunky' after using mysql - this is an sql statement question rather than a mysql tech question. if i run this: SELECT MK_01_vehicleRecords.registrationnumber, MK_01_VehicleRecords.vehiclenumber FROM MK_01_VehicleRecords WHERE (MK_01_VehicleRecords.vehiclenumber = '36176')
Running MySQL 5.0
I've just downloaded and installed 5.0 on my Pc/ win 98se. When I run the program MySQL Command Line Client, it appears to run for a second then disappears. I see the program flash open for a second and then it is gone.Complete newb needs some help.
Running Balance With Where
I am using the following query: SET @bal1=0,@bal2=0,@bal3=0,@bal4=0,@bal5=0,@bal6=0; SELECT Id, Date, FCode, Descr, Debit, @bal5 := @bal5 + DebT AS RunDeb, Credit, @bal6 := @bal6 + CreT AS RunCre, @bal2 := @bal2 + net AS RunBal, Rec FROM ( select fin_records.id, fin_records.id_production_unit as PUnit, fin_records.id_bank_account as BAcc, date_format(fin_records.fin_record_date,'%d-%m-%y') as Date, fin_accounts.fin_account_code as FCode, fin_records.fin_record_desc AS Descr, fin_records.fin_record_debit AS Debit, @bal3 := fin_records.fin_record_debit AS DebT, fin_records.fin_record_credit AS Credit, @bal4 := fin_records.fin_record_credit AS CreT, @bal1 := fin_records.fin_record_debit - fin_records.fin_record_credit AS Net, fin_records.fin_record_rec AS Rec from fin_records inner join fin_accounts on fin_accounts.id=fin_records.id_fin_account where (fin_records.id_production_unit='$up') and (fin_records.id_bank_account='$ba') and (fin_record_date between makedate(year(curdate()),1) and makedate(year(curdate()),365)) order by fin_records.fin_record_date,fin_records.id ) AS tmp; I should build another column to get RunBal2, that should include only records with Rec = 1.
Running Average
How can I get mysql to do a running average of a given field using dates from another column so that the average for each element is for a given time period rather than from the 5 rows next to the element?
Mysqld Is Not Running
cannot seem to run mysql commands, although queries seem to work well as I can make databases and view tables. Hope that makes sense. I installed mySQL 5 on Windows XP and tried to stick with the default installation options and paths. I lauch mySQL from this: ""C:Program FilesMySQLMySQL Server 5.0inmysqld", enter a password (but not a username so I'm assuming that's root user), get a mysql> prompt. So far so good. The following commands do not seem to work though: mysqladmin version mysqladmin variables Typing these commands then clicking the return key brings up the -> prompt. I've checked the processes and "mysql.exe" and "mysqld-nt.exe" are running. From a c: prompt I tried to install mysqld and was told it is already running. What am I missing here? I'm sure it is something very simple... Ultimately I need to bring in a table from a SQL dump from another system. I've tried using variations of: mysql -h host -u user -p dbname < dumpfile.sql I'm combing through the docs, but still don't have a clue.
MySQL 4.1 Running
I've been running mysql 4.1 for sometime and using phpMyAdmin (v2.6.2) to administer the databases. Using php scripts I can also update/insert etc the databases (maintained on my laptop Mac OS X Tiger). Suddenly, I can't get phpMyAdmin to load in the browser. I've also tried other MySQL GUI tools like CocoaMySQL and Navicat....they won't run either. I downloaded and installed phpMyAdmin 2.6.3-pl1 as well but no improvement. Why would mysql run but the admin apps not work?
Running MySQL From A CD-ROM?
I have used PHP and MySQL for a few years now. Just today I can across an application that had a MySQL database running locally off a CD ROM. I did not know this was posible. When the application runs it starts up the MySQL database without the user even knowing they are running it. It is pretty amazing. So I want to do the same thing. Is there any documentation on how to run MySQL locally. I would like to know how to build the database and create tables under these curcumstances.
Running 4.1 And 5.0 On Linux
Question: How can I run 4.1 and 5.0 simultaneously on linux - Suse 9.3 in particular? My goal is to do no harm to my current 4.1 setup. Can the 4.1 and 5.0 rpm's play nice together? Can I use the rcmysql commands for running multiple versions?
Running Sql Scripts
In the past I have always used phpmyadmin to access my mysql database. I am now doing something on a host that does not have php my admin. Can anyone help me either: 1. setup phpmyadmin -- I downloaded and uploaded to the server but I can't seem to get the config file correct or 2. how can I upload a sql script (creating all my tables) to the database.
Running Script
I'm jumping ship from a dead beat host - but first i'm trying the import on my own machine(osX). Exported all my data from phpMyAdmin 2.5.6. I did it in SQL format - one for the structure and one for the data - to a zip file(also tried with GZip).The file starts with comments and is being interpreted as all commnets - it seems there are no carriage returns - however when i look at it in any text editor or in mySql query browser, it's formatted correctly. I can place a carriage return after a comment line and reopen the query in the query browser and everything looks ok...until the next comment. My only thought is that it must be some kind of encoding issue - but i'm pretty lost when it comes to stuff like that.I've tried from the terminal/command line as well.
|