Jump to content

Some Noob Questions


jajtiii

Recommended Posts

Greetings,

 

I have created a couple of basic databases, for website login, content management and the like.

 

Now, I am attempting to create a more complex database and have a few questions I am hoping someone here might answer.

 

The following questions assume :

 

I am working on a Win2k professional box with IIS installed as my local test environment.

 

I have a Win2K server that I host two domains on (using a dynamic ip updater, TZO). This is my current production environment.

 

My current project will require a faster server that supports MySQL and PHP (at this point, I do not know what os it will be, but am assuming it will probably be *nix). This will be my NEW production environment.

 

1. If I create an entire database in my test environment, is it possible to port the database to my NEW production environment. I was thinking I could simply back up my local database and then restore it on the NEW production server, but wanted to know if there were other tools/commands I might use.

 

2. What is \'alias\' and how do you set it? It looks like you can set it for both databases and tables, but I never can find an example of the syntax for such a thing and how it works.

 

3. In MySQL, there are a few references to \'unsigned\', specifically when defining column/index types. What is \'unsigned\'? How does it affect the dB?

 

4. A script that I downloaded from somewhere talked about giving a user \'read\' access only to the data. I am not sure which right do I GRANT to this user. There is no READ grant. What do you use? \'Select\'?

 

5. As far as the DATA in a MySQL db is concerned, it doesn\'t matter what OS it is on, does it? It is stored the same way, correct?

 

Sorry for all the queries...just thought I might throw them out all at once=)

Link to comment
Share on other sites

Hey man.

 

1: Yes, it\'s possible. phpMyAdmin will let you import and export entire databases quite easily.

 

2: Aliases are just that. They\'re mainly used to help keep code cleaner and to prevent any data from being overwritten. If you performed a join on two tables, for instance, and they both had an ID field and you needed to select them BOTH, you could give the first ID field an alias so that it wouldn\'t be overwritten by the second ID field. It works for both field names and table names. Example:

 

[php:1:265a818570]$sql = \"SELECT table1.id AS id1, table2.id AS id2 FROM some_really_long_table_name_omfg AS table1 LEFT OUTER JOIN some_even_longer_table_name_wtf AS table2 ON table1.id = table2.id WHERE id1 = \'$id\'\"[/php:1:265a818570]

 

The key is the AS command. The general syntax is [table|table.field|field] AS [alias]. NOTE: You can only use field aliases in a WHERE clause (notice how I didn\'t use \'table1.id\' instead of just \'id1\' in the query). Table aliases will only give you an error.

 

3: Unsigned is a property of integer field types. It simply means that they cannot have negative values. This is good to have with ID fields.

 

4: I\'m not sure I understand you. Did the script tell you to grant the user a MySQL account with read-only access or did it simply say that it wouldn\'t let the user alter anything in the database when it is run? If the latter is the case, then yeah, it probably meant the user only has access to the SELECT command.

 

5: Nope, the OS doesn\'t really matter. Everything is stored the same way regardless of operating environment.

Link to comment
Share on other sites

Thanks a bunch for your assistance.

 

Basically, I needed to create two user\'s for this tool (it was a dB management tool...this new project would take forever if I had to type out a bunch of Inserts).

 

The tool is phpMyAdmin, and in the configuration file, it has the following variable :

 

$cfg[\'Servers\'][$i][\'controluser\'] = \'\';

 

which it then gives me the following as explanation :

 

// MySQL control user settings

// (this user must have read-only

// access to the \"mysql/user\"

// and \"mysql/db\" tables)

 

Again, I really appreciate your assistance with this.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.