473,396 Members | 2,099 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,396 software developers and data experts.

MySQL file in Access

JustJim
407 Expert 256MB
Hi all,

I have been given a file of a MySQL database which I'm supposed to familiarise my self with and in a couple of weeks start writing queries and reports to generate a price book.

The file has the extension .sql and it is full of lovely looking SQL (example below) and a lot of data, but I can only open it as a text file. A little bit of research tells me that Access can open .sql files but I can't seem to get my Acess 2007 to do so. Any hints?

Expand|Select|Wrap|Line Numbers
  1. /*
  2. SQLyog Enterprise - MySQL GUI v6.07
  3. Host - 3.23.58-log : Database - gold
  4. *********************************************************************
  5. Server version : 3.23.58-log
  6. */
  7.  
  8.  
  9. create database if not exists `gold`;
  10.  
  11. USE `gold`;
  12.  
  13. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  14. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  15.  
  16. /*Table structure for table `category` */
  17.  
  18. DROP TABLE IF EXISTS `category`;
  19.  
  20. CREATE TABLE `category` (
  21.   `id` int(11) NOT NULL auto_increment,
  22.   `name` varchar(60) NOT NULL default '',
  23.   `url` varchar(30) NOT NULL default '',
  24.   PRIMARY KEY  (`id`)
  25. ) TYPE=MyISAM;
  26.  
  27. /*Data for the table `category` */
  28.  
  29. insert  into `category`(`id`,`name`,`url`) values (5,'Small Trailing Sprayers','trailing'),(6,'Large Trailing Sprayers','trailing'),(7,'Rowcrop Trailing Sprayers','trailing'),(8,'Self Propelled Sprayers','self'),(9,'Truck Mount Sprayers','self'),(10,'Ground Gliders','trailing'),(11,'Pasture 3 Point Linkage Sprayers','3pl'),(12,'Rowcrop 3 Point Linkage Sprayers','3pl'),(13,'Director 3 Point Linkage Sprayers','vine'),(14,'Director Trailing Sprayers','vine'),(15,'Weedicide Sprayers','vine');
  30.  
  31. /*Table structure for table `content` */
  32.  
  33. DROP TABLE IF EXISTS `content`;
  34.  
  35. CREATE TABLE `content` (
  36.   `id` text,
  37.   `content` text,
  38.   `link_text` text NOT NULL,
  39.   `link_url` text NOT NULL,
  40.   `link_group` int(11) NOT NULL default '0',
  41.   `header_group` int(11) NOT NULL default '0',
  42.   `menu_order` int(11) NOT NULL default '0',
  43.   `last_edit` text NOT NULL,
  44.   `matatags` text,
  45.   `draft` text,
  46.   `restricted` text NOT NULL,
  47.   `folder` text NOT NULL,
  48.   `drop_down` text NOT NULL
  49. ) TYPE=MyISAM;
  50.  
  51. /*Data for the table `content` */
etc, etc
Jan 18 '08 #1
16 2413
Delerna
1,134 Expert 1GB
I don't know about access opening .sql files, but they may not run in access ecen if you could. 30% of your pasted code wont.
Also .sql are in SQL Sever/MySQL syntax and although access sytax is identical on the main there are slight differences

You could try creating the table manually in access with the same field names and datatypes. Then you could
copy the queries from the .sql file
create a new query in acces
then while in design mode of the query click the view menu and select the sql option and past the query in there. You may need to make a few modifications to get it to work due to the sytactical differences (probably not though)

Someone else may know an answer to using the .sql directly.

Have you tried the tutorials and samples in the help file. You would probably be better off starting there. If you have any specific difficulties ask the question here
Jan 18 '08 #2
Delerna
1,134 Expert 1GB
Oh, I forgot
Alternatively you could run the .sql file in MySQL and then import the tables into access.

You are meant to familiarise yourself with MySQL and Access in a couple of weeks. WOW.
Jan 18 '08 #3
JustJim
407 Expert 256MB
You are meant to familiarise yourself with MySQL and Access in a couple of weeks. WOW.
No, no it's not that scary. I'm very familiar with Access and SQL, I just don't have MySQL at home. If I could only see the relationships visually and see the meta-data then I would be right.

Actually I guess I can if I just sit down and read through what is effectifly a text file. I was just hoping it would be easier.

Any further help would be appreciated.

Jim
Jan 19 '08 #4
NeoPa
32,556 Expert Mod 16PB
You can copy and paste any SQL from your .SQL files into the SQL view of a new query in Access. The ANSI standard used in your Access 2K3 or 2K7 database will determine if it interprets it all correctly of course (ANSI Standards in String Comparisons). You should also remember that different queries separated by GO commands should not be lumped together in one query. Lastly, the record sources should all be available to the Access db before you expect to get much of use in a QBE display.
Jan 21 '08 #5
JustJim
407 Expert 256MB
You can copy and paste any SQL from your .SQL files into the SQL view of a new query in Access. The ANSI standard used in your Access 2K3 or 2K7 database will determine if it interprets it all correctly of course (ANSI Standards in String Comparisons). You should also remember that different queries separated by GO commands should not be lumped together in one query. Lastly, the record sources should all be available to the Access db before you expect to get much of use in a QBE display.
Yes, the trick is to get the record sources read from the .sql file. Not having any luck with that.

Jim
Jan 24 '08 #6
NeoPa
32,556 Expert Mod 16PB
Are they local tables?
Do they need to be linked first?

I'm not sure exactly where your problem lies (so am not sure if I can even help at this stage).
Jan 24 '08 #7
sierra7
446 Expert 256MB
Hi Jim
I'm hooking into this so I can follow your progress. I have the books and I've downloaded MySQL to demo upsizing from Access, but can't find the time.

Your sample .sql files are obviously 'procedures' for setting up a database. When I did Oracle some years ago (My God it's over 23 years!) we used similar command files to create the database, set up users and permissions etc. I'm out of the habit being spoilt by the Access GUI.

I suggest you download MySQL (it's free), fire it up and see what happens when it reads your files. Get some 'hands on'.

The syntax is similar but different from Access SQL. What would you do with all those single quotes? Some can go to square bracket but how do you decide left or right?

I shall watch this space with interest!
Best of luck

NeoPa; is there a way of monitoring a thread and recieving notification without joining it, please?

S7
Jan 25 '08 #8
NeoPa
32,556 Expert Mod 16PB
There should be S7.
It was there but has been lost after a recent update. I think everybody liked it so I expect to see it back again sometime soon. I assume you mean without adding a post?
Before the "Subscribe" button was introduced though, it was common practice simply to add a post consisting of "Subscribing" (although the 20 char minimun applies of course).
Jan 25 '08 #9
Delerna
1,134 Expert 1GB
Yes, the trick is to get the record sources read from the .sql file. Not having any luck with that.

Jim
You could copy this
Expand|Select|Wrap|Line Numbers
  1. INSERT  INTO `category`(`id`,`name`,`url`) VALUES (5,'Small Trailing Sprayers','trailing'),(6,'Large Trailing Sprayers','trailing'),(7,'Rowcrop Trailing Sprayers','trailing'),(8,'Self Propelled Sprayers','self'),(9,'Truck Mount Sprayers','self'),(10,'Ground Gliders','trailing'),(11,'Pasture 3 Point Linkage Sprayers','3pl'),(12,'Rowcrop 3 Point Linkage Sprayers','3pl'),(13,'Director 3 Point Linkage Sprayers','vine'),(14,'Director Trailing Sprayers','vine'),(15,'Weedicide Sprayers','vine');
  2.  
and make a csv file like this

id,name,url
5,Small Trailing Sprayers,trailing
6,Large Trailing Sprayers,trailing
7,Rowcrop Trailing Sprayers,trailing
8,Self Propelled Sprayers,self
9,Truck Mount Sprayers,self
10,Ground Gliders,trailing
11,Pasture 3 Point Linkage Sprayers,3pl
12,Rowcrop 3 Point Linkage Sprayers,3pl
13,Director 3 Point Linkage Sprayers,vine
14,Director Trailing Sprayers,vine
15,Weedicide Sprayers,vine

Import that into excel and then import the worksheet from excel into access as a table
Then you could re-name the table to 'category'


Or maybe access can import the csv directly, I don't know I have never tried
Jan 25 '08 #10
JustJim
407 Expert 256MB
Hi Jim
I'm hooking into this so I can follow your progress. I have the books and I've downloaded MySQL to demo upsizing from Access, but can't find the time.

Your sample .sql files are obviously 'procedures' for setting up a database. When I did Oracle some years ago (My God it's over 23 years!) we used similar command files to create the database, set up users and permissions etc. I'm out of the habit being spoilt by the Access GUI.

I suggest you download MySQL (it's free), fire it up and see what happens when it reads your files. Get some 'hands on'.

The syntax is similar but different from Access SQL. What would you do with all those single quotes? Some can go to square bracket but how do you decide left or right?

I shall watch this space with interest!
Best of luck

NeoPa; is there a way of monitoring a thread and recieving notification without joining it, please?

S7
I agree with everything (that's the kind of guy I am!). I tried to download MySQL, but I ended up with some sort of server service program. Where did you find the actual MySQL program?

Thanks for your interest, sorry I've been so slow, but I've been away on and off.

Jim
Jan 29 '08 #11
JustJim
407 Expert 256MB
You could copy this
Expand|Select|Wrap|Line Numbers
  1. INSERT  INTO `category`(`id`,`name`,`url`) VALUES (5,'Small Trailing Sprayers','trailing'),(6,'Large Trailing Sprayers','trailing'),(7,'Rowcrop Trailing Sprayers','trailing'),(8,'Self Propelled Sprayers','self'),(9,'Truck Mount Sprayers','self'),(10,'Ground Gliders','trailing'),(11,'Pasture 3 Point Linkage Sprayers','3pl'),(12,'Rowcrop 3 Point Linkage Sprayers','3pl'),(13,'Director 3 Point Linkage Sprayers','vine'),(14,'Director Trailing Sprayers','vine'),(15,'Weedicide Sprayers','vine');
  2.  
and make a csv file like this

id,name,url
5,Small Trailing Sprayers,trailing
6,Large Trailing Sprayers,trailing
7,Rowcrop Trailing Sprayers,trailing
8,Self Propelled Sprayers,self
9,Truck Mount Sprayers,self
10,Ground Gliders,trailing
11,Pasture 3 Point Linkage Sprayers,3pl
12,Rowcrop 3 Point Linkage Sprayers,3pl
13,Director 3 Point Linkage Sprayers,vine
14,Director Trailing Sprayers,vine
15,Weedicide Sprayers,vine

Import that into excel and then import the worksheet from excel into access as a table
Then you could re-name the table to 'category'


Or maybe access can import the csv directly, I don't know I have never tried
Could do... It's actually the relationships between the tables, which has whos foreign keys etc, that I'm interested. As I said, I could do that by opening the .sql file as a text file and reading it with paper and pencil handy. Would be easy to miss something if the naming conventions aren't good though.

Sorry to be so slow, I've been away for a while.

Jim
Jan 29 '08 #12
sierra7
446 Expert 256MB
I agree with everything (that's the kind of guy I am!). I tried to download MySQL, but I ended up with some sort of server service program. Where did you find the actual MySQL program?

Thanks for your interest, sorry I've been so slow, but I've been away on and off.

Jim
Hi Jim
I must admit that I bought a SAMS "Teach Yourself PHP, MySQL and Apache in 24 Hours" book (sound like what you need!) and it had a CD with the software (version 4)

I've just had a look at the MySQL website and I guess you would need "MySQL Community Serrver Version 5 for Windows". I eventually navigated to;-
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-essential-5.1.22-rc-win32.msi/from/pick
where you could pick a mirror site depending on your location.

The are many other download for Manuals, Installation instructions etc. and options for more operating systems that I have heard of, so I guess it does get confusing.

Best of luck

NeoPa: Thanks. I thought I had seen a Subscribe button but had managed to change my default settings by mistake.
I also thought you could view the responses in reverse order, which would have been very useful in dialogue with a certain OldBirdman recently! My scroll button is worn out.

S7
Jan 29 '08 #13
NeoPa
32,556 Expert Mod 16PB
To view in reverse order simply :
  1. Click on the Control Panel link at the top of any page.
  2. Look under Settings and Options down the left hand side and click on Edit Options.
  3. In the Thread display Options box there is an item Thread display Mode. You need to go in there and select "Linear - Newest First".
Jan 29 '08 #14
sierra7
446 Expert 256MB
NeoPa
Thanks for taking time to write comprehensive instructions.
S7
Jan 29 '08 #15
NeoPa
32,556 Expert Mod 16PB
Not a problem.
I'd even do it for members who aren't as active and helpful as you are Sierra ;)

PS. Remember the Home & End keyboard keys will work for you too, to get to each end quickly.
Jan 29 '08 #16
JustJim
407 Expert 256MB
Hi Jim
I must admit that I bought a SAMS "Teach Yourself PHP, MySQL and Apache in 24 Hours" book (sound like what you need!) and it had a CD with the software (version 4)

I've just had a look at the MySQL website and I guess you would need "MySQL Community Serrver Version 5 for Windows". I eventually navigated to;-
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-essential-5.1.22-rc-win32.msi/from/pick
where you could pick a mirror site depending on your location.

The are many other download for Manuals, Installation instructions etc. and options for more operating systems that I have heard of, so I guess it does get confusing.

Best of luck

NeoPa: Thanks. I thought I had seen a Subscribe button but had managed to change my default settings by mistake.
I also thought you could view the responses in reverse order, which would have been very useful in dialogue with a certain OldBirdman recently! My scroll button is worn out.

S7
That looks exactly what I'm looking for. Thanks for your help.

Jim
Jan 29 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Phil Powell | last post by:
I've read some online resources that utilize various MySQL command-line actions to migrate data from Access to MySQL. The situation is this: a group of co-workers of mine will be using an Access...
0
by: bruce | last post by:
Hi... Update.... We have the following setup in our httpd.conf file. We've tried to give what's related to the issue. We're trying to set up a virtual host for a test project. The behavior...
17
by: chicha | last post by:
Hey people, I have to convert MS Access 2000 database into mysql database, the whole thing being part of this project I'm doing for one of my faculty classes. My professor somehow presumed I...
2
by: news | last post by:
We currently have our mySQL server on the same box as the Apache server. For security and load balancing, we're going to be moving the mySQL server to another box. We're already using a single...
3
by: Xerxes | last post by:
Hi, I would like to import the tables from MySQL database into Access database and I am not sure how to go about it. I tired to "Import External Data" from Access, selected "ODBC database" from...
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...
8
by: eholz1 | last post by:
Hello Newsgroup, I have redhat 3.0 Enterprise, and mysql (3.58.xxx more or less) installed from a redhat rpm, and php 4.3.9 (installed from an rpm) - I can access data from my mysql db using php...
18
by: Bruce A. Julseth | last post by:
I have the following code $Host = "localhost"; $User = "Fred"; $Database = "house"; $Password = "mypw" echo "before mysqli<br />Host: " . $Host . "<br />" . $User . "<br />" . $Database;
8
by: The Natural Philosopher | last post by:
This is so weird. What I am trying to do is to upload files and stuff them in a mysql database. Everything works except the file content is zero. using the load_file command from mysql...
1
by: chanshaw | last post by:
Alright so I got php running and installed i have mysql running and installed the thing im having a hard time with is having the php to call information from the mysql database. Im on Windows Vista...
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
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,...
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
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...
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
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,...

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.