Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Using And Setting Up My First Database


1. how do I being in setting up my mySQL database which will be storing files consisting of TXT, SWF and images.
2. I want to be able to call these items from the database using PHP links and MySQL/PHP integration. Any tutorials on the web available for that that anyone knows of?
3. Easability. Where can I go to learn how to optimize all my code?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Setting Up A Database
I have just installed mySQL v.5 on my Windows VPS Remote Desktop.
In the past I've use shared hosting and simply followed the directions
of the web host when creating a database.

I simply need a single database created, a single user created for the database and password. And to grant permissions to that user.

Rather than read the manual, I was hoping someone could instruct me on accomplishing this, please.

Setting Up Database
im going to use mysql for my database and then i will you asp for programming. im using windows xp pro in a lan. can the computer in the lan access my database thru webpages hosted on my computer using IIS.

Setting Up Database
I have set up the basics. I'm a bit confused about the id unique key thing.
I have a database with about 30 fields. Everything has been working fine.
I just added a field called "id" and set it to Primary and Unique.
Now, I can no longer submit information to the database. I get the error.
"Duplicate entry '0' for key 1"
1. Do I need to send id a value and if so how does it automatically count for each record?
2. There must be a better way right?


Setting Up First Database
This is of course a MySQL database, which I will be accessing with PHP.
Ultimately it will need the functionality to output all entries beginning with a certain letter onto a page, in alphabetical order. My question (for now) is : Is it necessary or would it make it easier in the future if the database has a field for 'first letter'?
I won't necessarily be inputting these entries in alphabetical order so I won't be able to rely on the id to put things in the proper order.
Some general guidance on outputting things in order like this would be helpful as I don't want to set up a database table and do loads of data entry only to find it's not right.

Setting Up A Convoluted Database
I want to create a table system, in which one table is dependent on the other, namely: a database of vocabulary and a corresponding database of languages.

CREATE TABLE `language` (
`language` varchar(255) NOT NULL default '',
`specialcharacters` varchar(255) NOT NULL default '',
)
CREATE TABLE `vocabulary` (
`id` int(11) unsigned NOT NULL auto_increment,
`language` varchar(255) character set utf8 NOT NULL default '',
`known` text character set utf8 NOT NULL,
`unknown` text character set utf8 NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

This is a simplified version, but it ought to illustrate the relation I'm going to explain:

The "vocabulary" table contains rows of vocabulary with different properties, one of which is their language. The "language" table is supposed to be dependent on the "vocabulary" table. Whenever a row with a new language is created in the "vocabulary" table, a new row with the new language should be created in the "language" table.

If the last row of a language is deleted (or updated to have another language) in "vocabulary", then the corresponding row in "languages" should be deleted as well.

Now I've thought of different approaches to apply this ruleset:

1. With PHP. I could simply define clauses in my web application that do those things. It would be pretty complicated, messy and I would have to do it again and again, when I add features.

2. By forgetting about a separate table and simply integrating the languages in the "vocabulary" table. However, the properties of the different languages have to be saved somewhere and it would mean an immense redundant data load, if I integrated the same information into rows again and again.

3. With Triggers. I read up on this subject, because I was told, that this is was I needed. I came to the conclusion that triggers can't solve this issue, but I'd be happy to be proven wrong.

4. This is why I asked. Are there other possibilites? I was told about cascading deletes, but those would constitute the reverse of what I'm trying to do, wouldn't it?

Tutorials On Setting Up A Database For A Form
Does anyone know of any good tutorials for setting up the structure of a mySQL database for a web form?

Advice On Setting Up Address Database Please
(Before i start i feel obliged to point out my Noobie status so not to shock! )

As part of a larger poject i need to set up an name and address database.

Before i start i would very much appreciate some comments on the format of the primarry tables.

For example if i set first_name as VARCHAR(15), last_name VARCHAR(30) - this seems ok, but from experience what would people suggest as being realistic for the Address part..

Do i need several fields to allow for each line of the address:

MyHome
MyStreet
MyStreet2 (optional)
MyTown
MyCounty / State
MyPostCode

I have found several different stratergies for this such as VARCHAR with no max length.... is this a good idea?

Aslo UK post codes - i guess a VARCHAR of max 10 would suffice, but does any one know of an imput mask / regular expression to ensure valid imput?

Setting Up A Database And Linking It To A Website ?
Does anyone know how to setup a database linked to a website please ? I would like to setup a database so that when someone fills in their first name and email address to receive newsletters, it can automatically go into a database to be used later to email them their newsletters.

The (mysql ?), database in my cpanel is phpmyadmin version 2.8.0.2

Setting Up Initial Database Schema
I am new to MySQL but not DB's in general. Having normally used GUIs (SQL Server, MS Access etc) to build table and the like.

When creating tables etc is it normal practice to build the tables 1st, setting up data types, Primary keys etc then once all the tables are there go back and Ammend the tables to set the relationships???

My aim is to have one script to build the lot and I was putting in relationships as I went but then realised the order I build my table would be important then.

My guess is I have answered my own question, but would like to know if there is any other standard methods people use.

Setting Local Database Location
I use Adobe GoLive for web dev and am now incorporating PHP scripting and MySQL databases. Everything works really well as far as functionality (first time using GoLive for dynamic site dev) but I'd like to have the MySQL database file for the site reside somewhere in the directory structure that GoLive sets up as opposed to the default location set in the MySQL .ini file.

If I'm developing multiple websites, each with a MySQL database, how do I set things up such that each website's database resides in a different directory?

Setting Up Clone Database On Localhost
I am trying to set up a clone of my site which is hosted on Linux server. I have winxp, PHP, phpmyadmin, and MySQL Sever set up on Laptop.

I can get my server running, and myphpadmin, the problem is when I try and setup my database and change USERNAME from "root" to "HOST_USER_NAME" I get errors in php program.

Is there a good tutorial which gives a step by step on this type of setup.

Importing And Setting Up New Database And User
I am having trouble moving a database and website from another host.
Do we need to use the same user name and password that was previously setup?
We changed the code to use the root and root password, seems some pages work and some are blank.
I could not see how to setup a new user? so then we can try and use that to connect. The pages refernce this page main.php that has the following code.

<?PHP
mysql_connect("localhost", "entaction", "2a3wHTp1");
mysql_select_db("entaction");

$size = 15;
?>

This was changed to use the rooot user and password because we could not see how to setup the same user for the database, I was able to import the database fine and shows in the databases?
Need help getting this working using:

phpMyAdmin - 2.8.1
MySQL client version: 5.0.24
Thank you for any help.

Setting Up
Im wanting to set mysql/php on my mac. Im wondering if installing mamp is the same as installing each component seprerately. Can i get away with mamp or should i go through and set it up manually?

Setting Up An ISP
I am trying to figure out how to setup an ISP. I have
broadband in my shop and was thinking, I could setup the house to call into
my network and connect to the Internet through my DSL. I have servers with
Mandrake 10.1 for web/mail/ftp. Was wondering if this could be done and
what needs to be done for it to work?

Setting Up
I need to setup on which directories on my hosted servers. I am a member of a volunteer organization, but would like to have a wiki posting to help promote some of the events that have lower turnouts. Also to get comments and perhaps media from some of the more successful events.

I'm very new to this and am still reading up on some reference materials, but would like to have something tangible to work off of. Our budget is limited as well so I opted for the low budget plan for now, so I am still uncertain of the bandwidth I need.

Setting It Up
I need help on setting mySQL 4.0 on my windows 2000 small business edition server. how exactly do i do it? its downloaded, and set-up, now how do i use it?

Setting Value
I have a table (cont_id) with an auto_increment primary key, and I had deleted entries with much higher numbers than others.Those entries are no longer there, but auto_increment sets cont_id based on the high-number entry I deleted.Is there a way to re-set auto_increment so it adds +1 to the highest-number value for cont_id among the existing entries?

Setting A New Value
I'm trying to design an internet forum these days ...
In my database i have got a field called (ID) which represents the id of the topics and i have assigned it an (auto_increment) attribute...
My problem is that when i delete all the topics from the forum and after that add a new topic to the database the (ID) of that new topic continues to increment from the last deleted topic,
so how can i set the (ID) of the new topic to 1 in case all the previous topics were deleted?

Setting Up Tables
I'm having trouble figuring out the table setup and normalization I'll need to accomplish my goal.

Basically on my website I want students to register and from there they can log in and fill out what college they go to and create a list of courses they are taking and add/delete assignments for each course, and add grades they receive for each course.

I need help determining what tables I'll need and how I want to link them.

Let's say a STUDENT adds 6 COURSES and then 10 assignments in each course along with 8 grades he has received in the past week (to calculate GPA). How would I go about setting this up?

Setting Up Problemo
IM a database virgin and am wanting to get in to server side scripting.
Ive been trying to set up mysql on my machine by following this tut:
http://www.sitepoint.com/article/php...1-installation
Now ive got the mysql downloaded and installed n my machine and ive got to the point where ive opened the command prompt (im on windows xp) to installing mysql as a system device ( right towards the end of the first page in the tut).
Now ive got mysql in program files si im typing exactly this:
c:programfilesmysqlin>mysql-nt --install
but it doesnt work. Says the system cannot find the path specified but to get to the bin folder i literally go c rive then programfiles then the mysql folder then theres the bin folder right there.
Any ideas what i could be doing wrong. I dont have apache installed or anythig yet becuase the tut hasnt told me to. Is it all case sensitive, should there be a space between program and files?
any ideas?

Setting Font
I downloaded and installed mysql-essential-4.1.22-win32 somedays ago.

I found it doesn't support my mother tougue.

How can I set it support korean language?

should I install it again for setting font(character)?
or
can I modify the setting?

Setting All Values To 0 And Some To 1
Is there a single query I can run that will set all values of a single column to 0, but set some values to 1?

somthing like:

Setting Up MySQL On Mac OS X
I'm a novice Unix user, and I can't get MySQL set up properly on my
Mac. It seems to have installed OK, but when I try to run the
mysql_install_ db script, I get errors. I can't set the root password
either that the documentation tells me to.

As background, I just want to use MySQL to work with databases and PHP
and HTML to set up web pages for database input and output. I'm running
MySQL on my own machine at home, and have no use for passwords or any
other administrative functions. I'm just looking to use the program to
set up and query databases.

Can anyone point me to a way to avoid all the UNIX admin stuff and run
the database? I can get in, but the mysql database doesn't appear when
I hit SHOW DATABASES as the tutuorial says, and I can't access or
create new databases. I think all this may have something to do with my
user account on my machine, but I'm not savvy enough to know how to
override permissions, be root, or any of that stuff. Any hints?

Setting All Instances Of A Value To Zero?
I am writing a basic CMS for a project and i need to be able to set every instance of a value to zero in a mysql database.

eg. there are 20 entries, each with the value '1' in the 'default' column. I want to change all of their 'default' values to 0 in one query.

How can i do this?

Setting Up Defaults
Is there a way to set-up defaults to the fields using some SQL statment instead of going into each field and entering default values.

Setting Up A MySQL Db
how's it done? I have only ventured as far a local Access type db up until now, but I now need a db "out there" that can store info submitted from a form on one of my websites. I have recently been experimenting with phpBB as a piece of open-source (free) software that taps into MySQL on my webspace, and seems to take almost all the hard work out of setting up a complex forum. 

It there some software that will do a similar job for me with a db? And can such a db download its data to a local db, like Access?

Setting Replication Up !
I am trying to set server replication up but am struggling to get binary logging enabled on the master -

DB - mysql 3.23
OS - Win2k

I have added the log-bin entry on the master - but if I do a SHOW MASTER STATUS they are all shown as NULL -

Setting The ORDER BY
ok say a field name in a table is called "type" and there are 4 possible values for the "type" field (car, boat, motor, rv). I dont want to order it by ascending or descending i want all the rows labled car under the "type" field to apear first. and the same for rv, boat, and motor. How would i acieve this??

Setting Up A Username
I am both the user and the admin. I am using winXP, and I am the root. This is all happening on one laptop since I am using Apache as a server. I have to ONLY provide mysql with my password to get into my database.

My Q is how can I assign an actual username to myself, so MySQL connects my password that is already in use with the new username which I don't know how to create?

Setting Up MySQL
I set up MySQL, obviously not right.

When I attempt to use the command:

mysql -u root -p

I am then asked to type in my password. I do that and then

ERROR 2013 (HY000): Lost connection to MySQL server during query.

I run Win XP and Norton Internet Security.

Setting Up MySQL
I tried removing MySQL But when asked for my password it would let me type it & Im log in as admin. Please Help ASAP I need a MySQL Project done. here is the terminal line:

[flash-AlPB-1GHz:/usr/local] chadelso%
[flash-AlPB-1GHz:/usr/local] chadelso% cd /usr/local/mysql
[flash-AlPB-1GHz:/usr/local/mysql] chadelso% cd /usr/local
sudo rm mysql
sudo rm -rf mysql-3.23.47-apple-darwin5.1-p
[flash-AlPB-1GHz:/usr/local] chadelso% sudo rm mysql
Password:

Setting Up On Windows XP
1) I can run MySQL in a command prompt and create databases when I am logged into it at root happily. But then my application which hasnt got root access cannot see the database. How do I set up MySQL such that myApp can access a database created by root?
At present if I log in to MySQL using MySQL -u MyAPP
I cannot access the database that I created when I logged in as MYSQL -u root

MS Visual Studio 6 question.
2) I have copied all the .h files into my include directory, and the lib files to the library directory. I have fixed the slight bug in the header files that means the system cant define SOCKET (#define __LCC__)

If I just include the headers and compile it all works well. As soonas I try to use some of the C API commands I get linker errors which implies that the library is not loaded. I have added the library and I still get errors. What am I doing wrong here (or more likely, any suggestions for other things I can try?)

Setting Max_allowed_packet
I am having a problem with adding a large String to a mySQL field.. The size of the String is ~ 4MB and the datatype of the field to which I am inserting the string is - longtext.

When I try to insert the String I get errors - i.e.
"com.mysql.jdbc.PacketTooBigException"

I have tried to set the max_allowed_packet value, in the my.ini file.
i.e. set-variable =max_allowed_packet=16M

although, when I try again to repeat the process once I have set the max_allowed_packet.. I still get the same error Message. It seems that even when I set the max_allowd_packet to 16M, the actual allowed maximum value is 1M.

Setting Up Users
I have a website and db where people can login get setup and then enter information into the db, everybody has a unique client number, can I create a user for the db when they set themselves up as a user and restrict them from changing anything except data that is connected to their client number?

Setting Variables In My.cnf
how can I issue these client commands from inside the my.cnf file?

tep_db_query('set collation_connection=euckr_korean_ci', $link);
tep_db_query('set character_set_results=euckr', $link);
tep_db_query('set character_set_connection=euckr', $link);
tep_db_query('set character_set_client=euckr', $link);

Setting Value Of Row_count()
i have a stored procedure consisting of several delete statements and i
want to be able to return the "Query OK, 0 rows affected" such that the
total number of rows deleted are summed up rather than returning the
number of affected rows of the last statement.

the number of rows deleted can be obtained through the ROW_COUNT() and i
can add it up. but how do i set the value of the "Query OK, XXX rows
affected"?

Setting Password
I am using MySQL 4.1 on Win XP.I forgot my root password and I am trying to reset it. I am using the SQLyog GUI to manipulate my DB.I have a guest password stored in SQLyog and can access all of my databases.But I can't use SQLyog to change the password b/c it uses the new password alogorithm which is hashed to 32 characters opposed to 16 in the old alogorithm.I was wondering a way to reset my root password.I only have minimal privileges on this account such as SELECT.

Just in case anyone missed it,I can't log into my MySQL command line client since I don't know my root password.I would normally use OLD_PASSWORD('password') from there.

Setting Password
i've created my database and now i want to access it through php so im using:

mysql_connect('localhost:3306', "username", "password") or die(mysql_error());

but i haven't yet set a password and don't know how to, so when i run the file it comes up with the error:
mysql_connect() [function.mysql-connect]: Access denied for user......

is this because i need to set a password and username,if so then how? or is it maybe another different problem?

Setting Up New Item
I use myphpadmin and I am a beginner with it. I have this text based game and for items it's weapon, armor and shield.

I went to insert and did the fields and added a new item called "Herb" which heals your character 10 health. So now I go to the game to the admin control panel and its there but it can only be a weapon, armor or shield. I need to add a new class for "items" which is a healing item.

Setting Up A Relation
Is there any reason why two tables created with a relation in MySQL
wouldn't adhere to what you would think is a property of the relation?

Case in point: I have a 1:n 'relation' where I can insert values into
the dependent table while making up an entry for the foreign key from
the independent table (whether it exists or not). I shouldn't be able
to do that, but MySQL doesn't complain.

Setting Value For All Records
How would i go about populating a new column based on an existing column
pluse a bit of text.

i.e i have a column fldID which contains numerics 1,2,3,4 etc and i want to
poulate a column fldIMAGE with values 1.jpg, 2.jpg etc.

Setting Up A SQL Table
I want to use this:

$sql = "SELECT * FROM blogroll ORDER BY rand(" . time() . " * " . time() . ") LIMIT 1";

To pull random code into my WordPress theme (I will need to use lots of these random entries, so this method looks best, ATM).

Do I use this by creating a table in my database and replacing "blogroll" in the above line with the name of the table(say: randomphp)?

I will try this as soon as I figure out how to fill in the fields in the new table.

If I am correct about what I need to do please help me out with the fields on the table creation screen in phpMYadmin:

Field?
The code I want to put in place of the SQL string in my theme, right (a php include to be specific)?

Type?

Length/Values*?

Attributes?

Null?

Default**?

Extra?

primary, index, unique, or ---?

full text?

Setting A Maximum
I'm trying to get summaries of articles from my database, and I've tried a couple things though none of them seemed to be correct.

In my SELECT statement:

SELECT * FROM articles WHERE id=$_GET[id]

I want to specify how many characters(maximum) it should return. The field I want to limit is longtext and there are three other fields (2 varchars, and a date) but none go over 30.

I assume that this is possible since creating a separate field that contains a summary would be extra overhead.

Setting Up MySQL
This is how the server is started:
mysqlinmysqld --defaults-file=mysqlinmy.cnf --standalone --console

There's no "--old-passwords" but it's still not working.
I have Xampp, btw.
In my.cnf I took out the "old_passwords" declaration. I restarted the server a few times and it's still not working.

Setting Max_allowed_packet
I can't seem to set max_allowed_packet on server restart. Typically, to set it higher I've been restarting mySQL through the command prompt using the --max_allowed_packet=64M, but I want this to happen by default on server restart.
I tried editing my my.ini file with no success.
I've tried adding the lines:
max_allowed_packet=64M
--max_allowed_packet=64M
max_allowed_packet=64M
max_allowed_packet=67108864
and
--max_allowed_packet=67108864

Still, on server restart it always is the default 1048576.

Setting Up The Server
I keep getting an error number 1045 access denied whenever I try to run MYSQL Administrator. I just set this up. What did I forget to do?

I installed MySQL Server 5.0, the administrator, the query browser and the system tray monitor. What am I forgetting to do here?

Setting Up MySQL
Little 333 machine with Kubuntu Linux loaded and running fine for over a year. Grabbed Mysql 4.01 and MySqlAdministrator via Synaptic Package Manager. (yeah, I know - don't expect great performance - it is just my daughter's old former Win Me machine hat Linux has breathed a little new life into....)

Question: Looks like all I have is a command line interface to MySql at the moment. What must I do to define a database,username and password so that I can use the nice Admin GUI tool? It wants a server host name, user name and password, so I gather there is some set up work to be done from the Linux command line before I can proceed.

Setting Constraints
I want to create a table and set a constraints on a fields. For example for the int field all the inputs has to be greater then 5.
How do I go about doing it?

I tried this
create table Foo(
id integer(5) not null, constraint id_range check(id>5)

Setting Input
I'm using Navicat to develop MySQL database. I have a table cutomer table that will be connected to Jsp page to collect data from the user online. I was wondering how do I set an input mask to the email address:
such as: abc@yahoo.co.uk into xxxxxx@yyyyyy.zzzzzz
So this means that the user must enter their email address in that format otherwise it should return a message saying INVALID.
Also another question was: Im trying to set my price field in such a way that it accepts values like 2.50
but i tried using Double, real, numeric, float but it does not allow the zero at the end.


Copyright © 2005-08 www.BigResource.com, All rights reserved