by cliper
Wednesday, December 08, 2010 12:35 PM
Sometimes we want to have a dump of all our databases in mysql and restore it later to somewhere else or in the same server. here’s how...
In your terminal:
Backup database...
mysqldump -uuser -ppassword database_name>database_name.sql
where user is your mysql db user, and password. Note: No spaces should be inserted after -u and -p. Specially in -p for password.
To restore database...
mysql -uuser -ppassword database_name<database_name.sql
while we can do the above command for restoring. We can also do it safely by using the source keyword in mysql.
In terminal, do:
mysql -uuser -ppassword
When in mysql console, execute:
USE database_name;
SOURCE database_name.sql;
Make sure you change to the path of the file database_name.sql where it resides. Otherwise, you will get an error similar to: Failed to open file 'database_name.sql', error: 2
Also, we can back-up a table instead of the whole db.. you can do:
mysqldump -uuser -ppassword database_name table_name>database_name.sql
and should be able to restore it too.
by cliper
Saturday, August 16, 2008 5:04 AM
heh, I forgot to include the visual basic version. If I remember it right, I just told myself not to code vb anymore. But I can still code in both language so I decided to write some updates. :)
First, you need to change the connection string from the web.config file.
then run the application.
Still, I test the project twice in Debug mode. No release happened.
You can download the files below
mysql_datagrid_vb.rar (98.03 kb)
38140073-1451-4ee5-b2a9-9ac63b903697|0|.0
Tags:
ASP.NET | MySQL
by cliper
Friday, August 15, 2008 7:22 AM
hi, back again.. I'm glad that I'm not the only one reading my posts here.
There's someone e-mailed me today and would like to
have some samples on how to bind data into an asp.net datagrid control with MySQL. well, I ran to my computer
and code the app. And here it goes. It takes me 1 minute to code. Wow, so be careful with bugs. I runned it twice in a
debug mode. No release happen so please read the code first.
About comments, yes.. I only commented the web.config file since I don't know what to type from the code for now.
Still busy. But, I'll explain the code later when they ask. lol.
Anyway, there are lots of bulk blogpost (pending) in my notebook. I'll post it later when I'm home.
Again, thank you guys for reading.
Here's the project solution.
mysql_datagrid.rar (98.14 kb)
75993307-9e4c-4384-b3c6-67691bdd2081|0|.0
Tags:
ASP.NET | MySQL
by cliper
Saturday, July 05, 2008 8:39 PM
have some problems with mysql. can't find the exact phrase from the MySQL Documentation about this. Anyway, one of the guy from asp.net forum ask some unusual question. I encounter this before and I don't want this to be a burden soon.
In this, I use world.sql (sample db) from MySQL sample db's.
tried to execute this SQL statement (we need to test something. just made up something like this one):
SELECT Name FROM city GROUP BY Name HAVING MAX(`Population`) > 10000 LIMIT 20;
after that, we need to execute something like
DELETE FROM city WHERE Name IN(SELECT Name FROM city GROUP BY Name HAVING MAX(`Population`) > 10000 LIMIT 20);
Well, we can see a helpful message. :)
This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
thought of something to have the same.. and my last bet is to have a single line. like:
DELETE FROM city WHERE Name IN('name1', 'name2', 'name3');
if anyone would like to share some of their ideas, you might like to refer me a site. you can use my contact page above.
Cheers,
d3d7dac6-d72a-4480-9d08-46878f02b8a8|0|.0
Tags:
MySQL