473,769 Members | 5,742 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import Access into MySQL

Newbie Question:

Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?

Thanks...

Bruce
Jul 17 '05 #1
11 15194
Bruce A. Julseth wrote:
Newbie Question:

Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?
Try a MySQL group.
Thanks...

Bruce


--
MeerKat

Jul 17 '05 #2

"Bruce A. Julseth" <br*****@attglo bal.net> schreef in bericht
news:3f******** @news1.prserv.n et...
Newbie Question:

Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?

Thanks...

Bruce


From MS Access you can export tabels as CSV .... this CSV can be imported
in MySQL ..... if you have a MySQL interface installed (like phpMyAdmin)
it's very easy to import a CSV into your MySQL, if not, you can write your
own statement. Therefore have a look at the MySQL online docuemntation and
have look at load data in file

Marcel
Jul 17 '05 #3
I noticed that Message-ID:
<I6************ *********@news-text.cableinet. net> from MeerKat contained
the following:
Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?


Try a MySQL group.


But there is a php answer. I found this bit of code which works. (though
I note that mysql_db_query( ) is deprecated.

I export from access using a semicolon as separator save it as query.txt

then run this.

<?php
# MySQL database User ID, Password and DB name
$sql_id = "userid";
$sql_pwd = "pwd";
$sql_db = "database_name" ;
$table = "table_name ";
$infile = "query.txt" ;

# Connect to the database
mysql_connect(' mysqldb.gradwel l.net',$sql_id, $sql_pwd);

# Delete the current content of the table
$result = mysql_db_query( $sql_db,"DELETE FROM $table") or die ("Invalid
DELETE query");

# Optimize the current table (recover empty space)
$result = mysql_db_query( $sql_db,"OPTIMI ZE TABLE $table") or die
("Invalid OPTIMIZE query");

# Load local comma separated, fields enclosed by quotes text database -
File has to be in the same directory of this file
$result = mysql_db_query( $sql_db,"LOAD DATA LOCAL INFILE '$infile' INTO
TABLE $table FIELDS TERMINATED BY ';' ENCLOSED BY ''") or die ("Invalid
DATA LOAD query");

# Get how many records are present in the table now
$result = mysql_db_query( $sql_db,"SELECT * from $table") or die
("Invalid SELECT query");
$rows_count = mysql_num_rows( $result);

echo "Records: $rows_count"; mysql_free_resu lt($result);

?>

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #4
try this free program: http://www.zebradb.de/mdbtomysql/

/Peter
Jul 17 '05 #5
Question 1: How can you tell that "mysql_db_query () is deprecated"?

Question 2: I run the .php and get the mysql_error() on the

$sql = "LOAD DATA LOCAL INFILE '$infile' INTO TABLE $table FIELDS TERMINATED
BY ',' ENCLOSED BY \"\"";

$result = mysql_db_query( $sql_db, $sql) or die (mysql_error()) ;

I get the error: "The used command is not allowed with this MySQL version"

The constructed SQL looks like:
LOAD DATA LOCAL INFILE 'data.txt' INTO TABLE Serenade FIELDS TERMINATED BY
',' ENCLOSED BY ""

I run this command at a mysql command line and it works.

Why???

Bruce
"Geoff Berrow" <bl@ckdog.co.uk .the.cat> wrote in message
news:u3******** *************** *********@4ax.c om...
I noticed that Message-ID:
<I6************ *********@news-text.cableinet. net> from MeerKat contained
the following:
Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?


Try a MySQL group.


But there is a php answer. I found this bit of code which works. (though
I note that mysql_db_query( ) is deprecated.

I export from access using a semicolon as separator save it as query.txt

then run this.

<?php
# MySQL database User ID, Password and DB name
$sql_id = "userid";
$sql_pwd = "pwd";
$sql_db = "database_name" ;
$table = "table_name ";
$infile = "query.txt" ;

# Connect to the database
mysql_connect(' mysqldb.gradwel l.net',$sql_id, $sql_pwd);

# Delete the current content of the table
$result = mysql_db_query( $sql_db,"DELETE FROM $table") or die ("Invalid
DELETE query");

# Optimize the current table (recover empty space)
$result = mysql_db_query( $sql_db,"OPTIMI ZE TABLE $table") or die
("Invalid OPTIMIZE query");

# Load local comma separated, fields enclosed by quotes text database -
File has to be in the same directory of this file
$result = mysql_db_query( $sql_db,"LOAD DATA LOCAL INFILE '$infile' INTO
TABLE $table FIELDS TERMINATED BY ';' ENCLOSED BY ''") or die ("Invalid
DATA LOAD query");

# Get how many records are present in the table now
$result = mysql_db_query( $sql_db,"SELECT * from $table") or die
("Invalid SELECT query");
$rows_count = mysql_num_rows( $result);

echo "Records: $rows_count"; mysql_free_resu lt($result);

?>

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/

Jul 17 '05 #6
I noticed that Message-ID: <3f********@new s1.prserv.net> from Bruce A.
Julseth contained the following:
Question 1: How can you tell that "mysql_db_query () is deprecated"? Because it says so in the manual.
Question 2: I run the .php and get the mysql_error() on the

$sql = "LOAD DATA LOCAL INFILE '$infile' INTO TABLE $table FIELDS TERMINATED
BY ',' ENCLOSED BY \"\"";

$result = mysql_db_query( $sql_db, $sql) or die (mysql_error()) ;

I get the error: "The used command is not allowed with this MySQL version"


I remember I had a few problems getting it to work which is why I ended
up using the semi colon. But this sounds more like a problem with the
version of MySQL. Obviously your other queries are working.

--
Geoff Berrow
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Jul 17 '05 #7
In article <3f********@new s1.prserv.net>, br*****@attglob al.net says...
Newbie Question:

Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?

Thanks...


Doesn't Access have a facility to export a csv? Once you have a csv, you
should be able to do something with MySQLs LOAD DATA INFILE

Cheers
--
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?
Jul 17 '05 #8
Simply use ODBC and transfer Access Data > MySQL on the fly.

"David Robley" <robleyd[spam]@ozemail.com.au > schrieb im Newsbeitrag news:MP******** *************** *@news.spiderwe b.com.au...
In article <3f********@new s1.prserv.net>, br*****@attglob al.net says...
Newbie Question:

Is there a way to import MS Access into MySQL? Maybe create a CSV or
something. If so, what would be the SQL to do this?

Thanks...


Doesn't Access have a facility to export a csv? Once you have a csv, you
should be able to do something with MySQLs LOAD DATA INFILE

Cheers
--
Quod subigo farinam

$email =~ s/oz$/au/o;
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

Jul 17 '05 #9
Yes ... this is the way I transferred my Access data into
MySQL. Very easy.

Fli7e wrote:
Simply use ODBC and transfer Access Data > MySQL on the fly.


Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
3868
by: NotGiven | last post by:
I have a db that I need to dump into a format that can be easily read my MS Access. I tried the dump with regular PHPAdmin. Then I used the dump to run a query in MS Access. Errors occurred because MySQL inserts a backslash, "\", in front of an apostophe that user enters in a text field and MS Access doesn't know how to interpret that. Any ideas for easily getting whatever kind of data from MySQL to MS Access?
7
9296
by: jj | last post by:
It's taking forever to upload 400,000 records to the database through access/odbc, and I've tried phpMyAdmin's interface but it seems to timeout during import of a CSV file. Is there a better way to import 400,000+ records?
8
31084
by: Johnny | last post by:
I was looking for information on how to import an excel file or other text file into a MySql database. I have done this with both access and SQL Server and am looking for a way to do this in MySql. I have several hundred items i want to import into a parts database that is currently in an excel file but can be saved as comma separated or other format. Any help would be greatly appreciated. Thanks in advance. Zach
5
3309
by: Kajol | last post by:
Hi All, can u plz tell me how to import data from mysql to another database. & how to export data from anotherdata base to mysql Thanx for ur Advice Regards Kajol
3
3973
by: Daedalus.OS | last post by:
Hi, I've been asked to transfert a database from a webhoster to another. I think the database is on a windows box but I'm not 100% shure. The webhoster says it provides combined hosting on NT/Linux Servers. After exporting the database with phpMyAdmin I tried to import it to a Linux server with the mysql>source file.sql command via a ssh access (the file is 40 Mbytes so phpMyAdmin is useless). Everything seemed ok but all accented...
7
33417
by: phillip.s.powell | last post by:
We're looking at a GUI interface for our MySQL DB and I am interested in MySQL Administrator, however, one of our requirements is to be able to import/export databases. Is this possible or do I need to know else (e.g. Navicat)? Thanks Phil
10
3602
by: Simon | last post by:
Hi, I need to export a 200MB database from one domain to another. phpMyAdmin timeout after a while and is not ideal. I don't mind spending money if I have to but this is rather urgent. I only work on win32 machines but the servers are Unix machines. I don't have command line access to the servers.
0
3479
by: NewbieSupreme | last post by:
I'm using PHPMyAdmin on an Apache2Triad install (latest version; 5.x.x, which installs PHP5 and PHPMyAdmin 2.8 as well). In Access, I exported a table to a text file, tab-delimited, text qualifyer of "none" (this is how I read to do it from newsgroups). When I use the Query window in phpmyadmin to import the text file, it waits a while, then returns an error: #1064 - You have an error in your SQL syntax; check the manual that...
7
4196
by: Randy | last post by:
Folks: We have a web-based app that's _really_ slowing down because multiple clients are writing their own private data into a single, central database. I guess the previous programmer did things this way because it made things easy. Well, I'm the person that has to put up with the long-term headache. Anywho, someone at work wants things sped up, so what I'm looking at doing is this for each client:
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.