473,407 Members | 2,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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 15146
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*****@attglobal.net> schreef in bericht
news:3f********@news1.prserv.net...
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.gradwell.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,"OPTIMIZE 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_result($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.com...
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.gradwell.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,"OPTIMIZE 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_result($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********@news1.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********@news1.prserv.net>, br*****@attglobal.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.spiderweb.com .au...
In article <3f********@news1.prserv.net>, br*****@attglobal.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

<snip>
$sql = "LOAD DATA LOCAL INFILE '$infile' INTO TABLE $table FIELDS TERMINATEDBY ',' ENCLOSED BY \"\"";


I had a similar problem the other day on my Windows machine. It was solved
by removing LOCAL from the query.

Good luck,
Thomas.
Jul 17 '05 #11
"Bruce A. Julseth" <br*****@attglobal.net> wrote in message news:<3f********@news1.prserv.net>...
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?


YES
Incredibly simple. Been using it for 2 years now for several
databases.
SQLion is designed to import and export between MS Access (and Excel
and so on ) and MYSQL (and so on)

I click import, choose the Access db, choose the table and click
exceute (get on with it) == If I sound impressed I am, and I'm always
amazed that noone seems to have heard of it.

Anyways, go here: www.waiheke.co.nz/php/

seeya
Jul 17 '05 #12

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

Similar topics

6
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...
7
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...
8
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...
5
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
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...
7
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...
10
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...
0
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...
7
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.