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




Quick Question About Reseting Demo Database?


I would like to set up a cron job to reset my demo database on a regular basis. Is there a way to export an sql file via phpmyadmin, and run it as a whole via the PHP mysql commands? The only way I can see to do it, I have to split up the exported sql from phpmyadmin into individual queries. I'd like to just process the entire .sql file at once, as it would make maintenence much easier.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Where I Can Get Free DEMO DATABASE And TABLES For My Practice?
I want to hone my skills on MYSQL but i want to have dummy database and tables, and specially the contents of the tables the datas.

because i want to...
practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, practice, and practice.....

Reseting Ids In Table
Is it possible to reset ids in table? Well I have nameid and name fields in table and it now has ids of 3 4 5 7 9 10 11 ... and i want it to be 1 2 3 4 5 6 ... again. is it possible? in MySQL db?

Reseting Auto Increment Id Number
When deleting table, id-value won't reset. How can i reset it?
ID is auto increment int

example table food:

id name
1 carrot
2 apple
3 orange

when delete from food id remains in value 3
so when inserting new data list starts from id 4

4 pineapple
5 mushrooms
... how can i set the id value to 0.?

Reseting MySQL Root Passwd
I forgot the MySQl root password since I installed it. is there a way to reset it? It is running on Fedora Core 3 and I have Linux root access.

Quick Join
I have two tables Matches (m_id, m_winner_id, m_loser_id) and Users (u_id, u_name). m_winner and m_loser_id are foreign keys.

Now I want the querry result to look like this: Match ID | Winner Name | Loser Name.

I did a join query:
Select matchs.id, users.name From matchs, users Where matchs.winner_id = users.id

How do I get the loser name?

Quick Fix 4 MySQL Pro
I will have a few instances like this and since I'm new to MySQL, perhaps a good example will help down the road. All I want to do is display a list of the first and last name of the names in my DB so they appear like so:

John Smith
Suzie Johnson
Etc...

first and last are two separate fields in the DB so I just need to join them together. The code I have now gives me this error:
PHP Notice: Undefined index: first in e:etc...

<?php
// Request the names in db
$result = mysql_query("SELECT artist.first, artist.last FROM artist");
if (!$result) {
echo("No artists posted at this time");
exit();

code...

Quick Join
I have a quick SQL question:
I have two tables Matches (m_id, m_winner_id, m_loser_id) and Users (u_id, u_name). m_winner and m_loser_id are foreign keys. Now I want the querry result to look like this: Match ID | Winner Name | Loser Name.

I did a join query:
Select matchs.id, users.name From matchs, users Where matchs.winner_id = users.id
How do I get the loser name?

Quick PhpMyAdmin
I believe I got phpMyAdmin setup to work right, I used HTTP authentication, and I get a log in screen when I goto the url. How do I set up an account for that?

GRANT ALL PRIVILEGES ON acct1_db.* TO 'Brian'@localhost IDENTIFIED BY 'password';

Is that right? I wish to host websites off this computer and have multiple users. Do I need to log in to the controluser account to do it? Or am I way off?

Quick Query
this one shoud be easy, but I just can't think of the best way (other than writing a php script to do it). I have a CMS and need to change one word in the description field for 64 rows. For example, where we now have 64 entries with "Bilbo" in the middle of the data, we need to change it to say "Frodo" instead. (Actually, I need to replace a misspelled javascript toLowerCase() call...darned non-programmers! They used toLowercase() - note the lower case C)

Quick Queries
Is it possible to use a regular expression or similar in a mySQL query, to make 'fuzzy' comparisons, or is LIKE the best we can hope for?

QUICK AND EASY ONE
im fairly new to php/mysql so please bear with me
I am trying to upload a txt.file created from an excel spreadsheet using the following query:

LOAD DATA INFILE 'path/file.txt' INTO TABLE my_table;

im getting a syntax error!
what could be wrong? are there any other attributes i should be adding to this query? i also tried uploading a csv version of the same file and get the same error.

Quick COUNT()
The MySQL documentation says:

COUNT(DISTINCT expr,[expr...])

Returns a count of the number of different non-NULL values.
How do i get it to INCLUDE null values? I am using COUNT with the DISTINCT bit as well, and i want the NULL rows to count as one as well.

Quick Tip: Switching Field On/off
Ever wanted to change a database field (typically TINYINT(1)) from 1 to 0 or from 0 to 1 depending on the current value?

No need for two queries. I just thought of this 'clever' way to take care of it. Never saw that done this way before, and should have thought earlier about this.

UPDATE articles
SET published = ABS(published - 1)
WHERE id = x

How To Dump (quick) A Table Into Another One.
On MySQL, I've got a table I use as 'wild card'. I mean, I store
data into it and, at the end, I dump all the date into 'production'
table.

Until now, I perform it following these steps:
1) I empty 'production' table
2) I make a SELECT of every rows of the 'wild card' table and an
INSERT into 'production' table.
3) I empty 'wild card' table.

But I've got problem: during SELECT+INSERT time, 'production' table
is not full and there's a data lack.

How To Dump (quick) A Table Into Another One.
On MySQL, I've got a table I use as 'wild card'. I mean, I store
data into it and, at the end, I dump all the date into 'production'
table.

Until now, I perform it following these steps:
1) I empty 'production' table
2) I make a SELECT of every rows of the 'wild card' table and an
INSERT into 'production' table.
3) I empty 'wild card' table.

But I've got problem: during SELECT+INSERT time, 'production' table
is not full and there's a data lack.

Quick Ones To Speed Up Access
------=_NextPart_000_0032_01C35FC2.62884DE0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

I am querying from a table containing more than 40,000 records. Earlier =
when the records were 10,000 it was taking 9 sec and now after 1 year =
and 40,000 records its taking 30 sec. Code is the same.=20

I am pretty sure that it has something to do with database only. No body =
can think of spending 30 secs for retrieving values from tables unless =
it's very huge in the sense of millions of records. =20

I don know whether I have to modify my database or do some sort of =
restructuring or reindexing so as to make it fast enough.

Is there some methods or optmization which can be applied to this =
database which hasn't been touched since design to enhance the spped.=20

If there are some quick ones but valued alottttttt please let me know.

Dump (quick) A Table Into Another One
On MySQL, I've got a table I use as 'wild card'. I mean, I store
data into it and, at the end, I dump all the date into 'production'
table.

Until now, I perform it following these steps:
1) I empty 'production' table
2) I make a SELECT of every rows of the 'wild card' table and an
INSERT into 'production' table.
3) I empty 'wild card' table.

But I've got problem: during SELECT+INSERT time, 'production' table
is not full and there's a data lack.

I'm looking for a faster way. Does anybody know it? Thank you very
much.

PS: I was told about 'mysqldump', but I do not know if it's faster
than mine.

Quick Date Subtraction Question
When I do the following, I get the number of days in difference between two dates however for the dates that have expired, I get the number of days back negated, ie -3 for example?

What I actually want is that if there has been an expiration, I want the result for a given row to be 0. Anyone got an idea how to?

// timestamp is datetime creation of record
// expires is date in future, ie 7, 14, 21 or 28 days in that increments
mysql> select day( expired ) - day( now() ) as days from polls;
Here is an example of the data returned,

+------+
| days |
+------+
| 7 |
| 7 |
| -3 |
| 7 |
| 7 |
| 21 |
| 7 |
| 7 |
| 14 |
| 21 |
| 7 |
| 21 |
| 7 |
| -3 |
| 21 |
| -3 |
| 7 |
| 7 |
| 7 |
| 14 |
| -3 |
+------+

Quick And Easy Update Query? Or Not Possible?
I need to do a global change to a column in my database. I know this is poor planning on my part, but I recently made a change to all of my image extensions for speed purposes.

I have a column called thumbnail_path, and every value ends with .GIF. I would like to change them to all end in .JPG. How can I do this? Is this even possible to do in one update query? or will I need to select, parse w/ php and then update?




Quick Question - Id Mediumint(8) - Does The (8) Matter?
just a quick question really..

Just setting up 1 of my tables and just wondering if it matters if i set my id to mediumint(8) but i only ever get to 6, will this effect anything in anyway?

Same goes for - address varchar(50) and say that no address ever reachs 50?


Quick & Easy MySQL Sync?
Does anyone know of any quick and easy way to sync a local development mysql server to a remote server and back. I'd like to be able to optionally sync either direction?

Quick Mysql Auto_increment Question
i noticed that after adding some test data into my table the autoincrement is working fine. but after i delete them, even though the table is empty again the new data i put in will have primary key thats in auto_increment as if the old data was there.

for example i added in 2 rows. now i have an id 1 and id 2. i delete them and the table has no rows. but now i add another two rows after wards and they get assigned id 3 and id 4. is there anyway for me to make the counting start over??? thanks for any replies or thoughts on this.

Multiple WHERE X='$x' In A Query. (Quick Answer Needed)
My query works when I only use one WHERE instance, but not with both, and i know I have data that matches both criteria. Is this the proper way to pull results that match 2 criteria?

$query = "SELECT * FROM Cartridges WHERE TYPE='$TYPE_Query' & PRINTER='$PRINTER_Query' ORDER BY ID ASC";

Quick "WHERE"
Part of a WHERE criteria I'm trying to construct needs to return only those records where a date field in my adkey table contains a date older than a user-specified date (submitted as variable {sRemoveDate} from a web-page form). The following works:
CODEWHERE
(adkey.D_RemoveDate < '{sRemoveDate}' Or
adkey.D_RemoveDate is null)

Could Not Connect To The Database, Please Recheck The Settings You Specified. Also Make Sure That A Database With The Name You Specified Already Exists On The Database Server. PhpAdsNew Will Not Create The Database For You, You Must Create It Manually
The error message I get above is the same everytime when trying to install phpAdsnew. I have tried everything. I am hosted through yahoo! and have actually succesfully installed scripts before even though I know nothing about it. Now that I have a "auto-install", it does not work. Yahoo! also offers php-nuke with the auto-install where you just click a few buttons, and I get a similar error stating that it can not conect to the database.

Please can anyone help me and tell me what I am doing wrong?

Database Transfer Between Oracle 8 Database And MySQL Database
Is it somebody out there who has made a migration from an Oracle server to an MySQL server??

The scenario is as simply:

I've got a Oracle 8 server with a database with content that I want to transfer to a MySQL database. No special data, constraints etc that MySQL not will handle.

My solution is to reverse engineer the database from ERStudio and then produce a SQL script that will insert the data into the MySQL engine.

But I can't do this, because the customer want me to do a PL/SQL script that does this, even if he never have worked with Oracle.. So the question is.. Do someone know a simplier way to do this or do I have to teach myself PL/SQL and make a script that produces a MySQL sql script ?

Create Error: Access Denied For User: '@localhost' To Database 'database Name'
I have already installed the php4, apache and mySQL on windowsXP SP2.
when I wanted to create database through PHP code it showed me error like this "Create Error: Access denied for user: '@localhost' to database 'database name'" and I can't even create database using mySQL either.

Script For Uploading Data From Local Database To Production Database
I am using MYSQL 4.0 for my local and production databases. I want to extract selected records from selected tables from local database and upload them to my production database on daily basis. In other words, I want to upload data which is entered in local database on daily basis to my production database.

How To Apply New Database Structure To An Existing Database, Without Overwriting Data?
I am writing a simple blog software application. We released a version of this software a while ago.

It comes with a sql-tables.sql file, that you can just import into your mysql database and it will setup all the tables for you, for a fresh installation. We made the sql file by just doing an export I believe, without exporting the data that was in OUR database.

Well, since then several people have downloaded and installed our software, and are using it.

We are about to release a new version soon, however. Since it is all still under development, many things have changed in our database structure. We've added new tables, and modified or even removed fields from existing tables.

So for the new release, we're going to include a new sql-tables.sql file obviously, so that for fresh installations they can still install it just like normal.

However, the question is... how do you "upgrade" all the previous version's users's databases, without losing any of their data?

Is there anyway to export just the structure of our current database... then somehow apply it so that it just goes through and changes another database to match the new structure?

Or any ideas at all how to do this?

How To Convert MS Access Database To Mysql Database??
now i have more than ten thousand data in MS Access database and now i heed change it in to mysql database!So do you know how to that?I think i not time to key in back this all data because it is imposible la,because more than 10 thousand data la!

Converting Ms Access Database To Mysql 5 Database
I've imported a ms access database into a table in a mysql database.
The access database contains a field that holds date/time values in
'general date' format. These all show up at 01/01/1970 in the mysql
database. I believe the field in mysql is wanting UTC and shows
numbers when looked at from the sql command line (i.e. March 13, 2006,
5:31 pm is shown as 1142289086). How do I get the access data into
that format so it will import properly?

Cannot Select Database: No Database Selected
This is the error I get in multiple locations on my website. I am using postnuke for my website. I get this error when I try to access my PostCalendar, PNaddressbook, the modules area in the admin screen, the permissions area in the admin screen, and the blocks area in my admin screen. I had a backup of the entire postnuke folder when it was working. I replaced it with the functional postnuke backup and the problem still exists. I know it isn't Postnuke. The only possible problem could be in MySQL.

Database Error : No Database Selected
I am trying to install an application called weberp on my website.

I have writen a script to test that the database name, user name, and password are all correct, and mysql is there and running okay.

I entered a script into myphpadmin to establish the database. All the tables, and so forth, were created with no errors.

How To Convert .dbf Database To Mysql Database
i want to convert .dbf database to mysql database. i have my college results in .dbf format file. i want to convert it from .dbf to .sql .

Database Error : No Database Selected
I am using myphpadmin to try and install weberp on a website.

I keep getting this error, and I can't figure out why.

The username, password, and database name; are all correct. The script to set up the database ran with no problems.

Extracting Data From Large SINGLE-table Database To MULT-table Relational Database
I have a very large single-table database of articles that I want to convert to a multi-table, relational database.

The existing single-table database contains fields for article author, article source, and article category, where several 'author', 'source', and 'category' IDs repeat dozens of times for hundreds of different articles.

I want to create seperate tables for author, source, and category and populate the new tables by extracting data from the original single-table database by unique ID field.

I figured out how to use INSERT and SELECT to pull data in new tables, but can't figure out how to pull only a single instance of a unique author, source, and category to create master reference tables for author/source/category.

Convert Ver 4.0 Database To Ver 4.1 Database
I do not know if this is the correct forum to ask this in or not.
We have changed hosts and the old hosting company was running MySQL version 4.0.27 standard and our new host is running MySQL version 4.1.22 Standard.
We have a database from the old host that we need to convert to MySQL ver 4.1.22 so we can use it on the new host.
We were running a older version of SugarCRM on the old host but we upgraded when we went to the new host and the new version of SugarCRM will not work with the copy of our old database file. It says that it needs MySQL version 4.1.2 or higher.
Is there any way to convert the old data base.

How To Copy Mysql Database Table To Another Mysql Database
i have database named(rocky) in the other domain how can i copy it in nessan database in the other domain.

Dropping Database Called &quot;database&quot;
I have finally managed to install and configure mysql on my pc for testing but need to import data from an Access Database.

I first found out that I had to create a new user and grant priviledges to it - which means I could connect.

My next stage was using the migration tool to import the data.

This did not go so well...

Firstly, many of the table names had spaces in them which means that they are effectively useless in mysql.

So I thought I would start again, ensuring that the tables are first renamed in Access.

I then went to show databases and, during the migration process, it has given the imported data the default name of "database".

I now have a major problem deleting it as it thinks the name is an instruction!

Anyone know how to get over this issue?

Move Table From A Database To Another Table In A Database
I am currently developing a project as I am only a web designer.

I need to move a table from a database to another table in a database.

I am using SQL Server 2005 Express. How is this done?

I have been stuck for months trying to figure this out!

I have even bought SQL Server Express 2005 for Dummies and cannot figure this out!

I need someone to hold my hand and walk me through this literally! Or give me syntax code to do this.

Database
I'm working on a table which contains every member of our website. The table has 5 fields.

Name
Rank
Joindate
Picture
Information

The last one is the one that is bewildering me. You see, my goal is to have the information show up for each member's page. Now this information is several paragraphs long for each member. My question is how I should go about putting the information in the table. Should the information itself be in a .txt file and the url to it be in the table? What datatype should I use for the url, varchar? Is there a completely different way to do this?

Using One Or More Than One Database?
I am doing preliminary research for a future project and would like to ask your opinions on what you suggest is best for maximum database speed as well as stability and reliability.

This project would be a web store with tables relating to product info, client info, community forums, financial data, etc. The product info tables would have the most querries, potentially up to tens of thousands of hits per second. I would like people to be able to login without any delays and to get search results back on products within a fraction of a second.

Would it make sense to put the product tables into their own database separate from the community forums and client info tables even if they are hosted on the same server? Would there be performance difference and/or better stability, reliability?

What about having these separate databases hosted on separate servers? Would that be better than having one all-embracing large database on one server or perhaps on a server cluster? Would there be scalability issues?

Specifying Database Name
I executed a sample jsp, connecting mysql using connectorJ with tomcat.It works fine but it i need to know where I can specify which Database it should use. where can i specify the name of database .

Same Database Name
We are running mysql 4.1.18

Is there a way to prevent users from creating the same database name?
for example our name schema goes like: mysql_1234, mysql_32143, mysql_....
But we found out that some one could create MYSQL_1234 while mysql_1234
already exists.

I guess what we need to know is that if there is away for mysql to not
allow same names even though its different case characters.

Database
I was reading a post on PHPmyadmin here. It got me thinking about just what goes on in there as I never use it being a novice at such things. I had a reason to look for a tut on PHPmyadmin when my password would'nt work on WP and it would'nt accept. I learn here today I should have 'flush privileges' afterwards which I did'nt do, anyway I finally got a new password in the normal way.

Today I thought I would look again at PHPmyadmin and see that SMF database is still there with all the members. In Fantastico no SMF how do I install that database to a new install of SMF is the question?

Database
I want to set up a database like IMDB.com but for my stample collecting club. Is there any open source databases like IMDB that I could use that would work like that?

100 MB For A Database
How much is 100 MB for a database? How about a Joomla driven site? Is it enough, a lot, tight...?

What Database To Use
ok, I've been using text based Databases for my website, and i'm wanting to move up in the world, i was thinking MySQL.

what would be the best DB for a CGI script? and where and how would i start. any thoughts would help, i know a lot of you have been doing this for a long time, so i would like to get some experienced help.

Two Database
i want to select two tables from two different database. is it possible? i want to know the equivalent of this code in mysql.

SQLString = "SELECT * FROM StaffTable INNER JOIN datalog.dbo.Employees ON StaffTable.PinProfile = datalog.dbo.Employees.Payroll_id WHERE PinProfile = '"&Session("user")&"'";


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