Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

SQL script error


  • Please log in to reply
4 replies to this topic

#1 chromebuster

chromebuster

  • Members
  • 899 posts
  • OFFLINE
  •  
  • Gender:Female
  • Location:the crazy city of Boston, In the North East reaches of New England
  • Local time:07:23 AM

Posted 22 July 2010 - 09:09 PM

Hi,
I was organizing version 5.1.48 of MySQL so that I can use it with C# and other .net components, and so I figured that since I am playing with ASP.net applications and stuff, I'd create a database with a user who has access to everything in that database as often most apps require that. Instead of putting in the commands one after the other, I created the following script:
create database Mojo_Portal;
Create User 'MojoUser'@'Localhost' identified by '***';
create user 'MojoUser'@'%';
grant all on Mojo_Portal.* to 'MojoUser';

When I connected to MySQL via the root account, using the - u root -p password option and then entering the root password, I then proceeded to type the following to execute the script:
\. C:\Initial_Creation_Script;
I was greeted with the error "Mysql failed to open Initial_Creation_Script, error: 2," What does this mean? Any input would be great. I've looked all over the manual for this information, and I can't find it anywhere. I've even looked on the internet. Any input is much appreciated.

Many thanks,

The AccessCop Network is just me and my crew. 

Some call me The Queen of Cambridge


BC AdBot (Login to Remove)

 


#2 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:04:23 AM

Posted 22 July 2010 - 09:14 PM

"What does this mean -> failed to open Initial_Creation_Script"

I believe it means that MySQL couldn't open that script. Does MySQL have permission to read from that location? Is the file actually in that location?

Billy3
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#3 chromebuster

chromebuster
  • Topic Starter

  • Members
  • 899 posts
  • OFFLINE
  •  
  • Gender:Female
  • Location:the crazy city of Boston, In the North East reaches of New England
  • Local time:07:23 AM

Posted 22 July 2010 - 11:05 PM

I checked and rechecked to make sure that I wasn't typing it in wrong. It's definitely there. I even checked to make sure that all capital letters were inserted in the wright place. But two things now. Firstly, how can I check to make sure that MySQL has permission to access the root of the drive? And secondly, did the error come due to any syntactical errors that I might have made when writing the script? and if it helps at all, the file extension is .sql. thanks so much.

Chroembuster

The AccessCop Network is just me and my crew. 

Some call me The Queen of Cambridge


#4 Billy O'Neal

Billy O'Neal

    Visual C++ STL Maintainer


  • Malware Response Team
  • 12,304 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Redmond, Washington
  • Local time:04:23 AM

Posted 22 July 2010 - 11:14 PM

Firstly, how can I check to make sure that MySQL has permission to access the root of the drive?

Try to load the same script from somewhere you know MySQL has rights to, such as a temporary folder you create, and set permissions on that folder to Everyone: Full Control.

Giving MySQL access to the root of the drive is a very bad idea -- that location is locked down by default for a reason. If someone hijacks MySQL you don't want them to be able to take the whole drive with them.

And secondly, did the error come due to any syntactical errors that I might have made when writing the script?

How can MySQL check for syntax errors when it can't open the file?

the file extension is .sql


Hmm.. you didn't seem to specify that:

C:\Initial_Creation_Script;

MySQL isn't psychic -- you need to include the extension there.
Twitter - My statements do not establish the official position of Microsoft Corporation, and are my own personal opinion. (But you already knew that, right?)
Posted Image

#5 chromebuster

chromebuster
  • Topic Starter

  • Members
  • 899 posts
  • OFFLINE
  •  
  • Gender:Female
  • Location:the crazy city of Boston, In the North East reaches of New England
  • Local time:07:23 AM

Posted 23 July 2010 - 11:38 AM

Thanks. I'll make sure that I move that file out of there then and put it in another place. And how do I check permissions on folders? It's in admin tools in Windows 7, isn't it? I forget. But thanks for the tip. I can't believe that I forgot to mention the fact that the file is an sql file. My bad.

The AccessCop Network is just me and my crew. 

Some call me The Queen of Cambridge





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users