Import/Export MySQL databases and other commands

Posted in MySql on June 16th, 2010 by phoenixdigital

Just a quick reminder of how to backup and restore MySQL databases.

nice mysqldump --opt -u [user_name] -p [database_name] | gzip > [backup_file].dump.gz
or
nice mysqldump --opt -u [user_name] -p [database_name] | 7za a -si database7z 20140306-database.dump.7z

To restore

nice gzip -d [backup_file].dump.gz
nice mysql [database_name] < [backup_file].dump

To create a database

mysql -u root -p
create database [the_database_name]

To change the database
use [the_database_name];

To show all databases
show databases;

To show indexes on a table
SHOW INDEXES FROM products;

To show all tables
show tables;
or
show tables like "test1";

Adding a user if following doesn’t work

CREATE USER blah
or
insert into user (Host,User ,Password,Select_priv ,Insert_priv ,Update_priv ,Delete_priv ,Create_priv ,Drop_priv ,Reload_priv ,Shutdown_priv ,Process_priv ,File_priv ,Grant_priv ,References_priv ,Index_priv ,Alter_priv ,Show_db_priv ,Super_priv ,Create_tmp_table_priv ,Lock_tables_priv ,Execute_priv ,Repl_slave_priv ,Repl_client_priv ,Create_view_priv ,Show_view_priv ,Create_routine_priv ,Alter_routine_priv ,Create_user_priv ,Event_priv ,Trigger_priv ,ssl_type ,ssl_cipher ,x509_issuer ,x509_subject ,max_questions ,max_updates ,max_connections ,max_user_connections) VALUES ('%', 'theUser', password('thePassword'), "Y","Y","Y","Y","Y","N","Y","N","Y","Y","N","Y","Y","N","Y","N","Y","Y","Y","N","N","Y","Y","Y","Y","N","Y","Y","","","","",0,0,0,0);

Reload all user tables and priveleges
FLUSH PRIVILEGES;

Tags: , , , , ,

Javascript inArray functionality

Posted in Javascript on June 15th, 2010 by phoenixdigital

Some useful examples of prototyping functions in javascript. As well as an efficient method of searching the contents of an an array for a particular value.
Read more »

Tags: , , ,

.NET Execution Order

Posted in C# Programming, VB .Net Programming on June 6th, 2010 by phoenixdigital

When a page is loaded the execution order is


Page_Init(object sender, EventArgs e) {}
Page_Load(object sender, EventArgs e) {}
Page_DataBind(object sender, EventArgs e) {}
Page_PreRender(object sender, EventArgs e) {}
Page_Unload(object sender, EventArgs e) {}

http://support.microsoft.com/kb/305141

Tags:

C# Primitive Types

Posted in C# Programming on June 3rd, 2010 by phoenixdigital

Useful lookup of variable types available in c#

C# Type .Net Framework (System) type Signed? Bytes Occupied Possible Values
sbyte System.Sbyte Yes 1 -128 to 127
short System.Int16 Yes 2 -32768 to 32767
int System.Int32 Yes 4 -2147483648 to 2147483647
long System.Int64 Yes 8 -9223372036854775808 to 9223372036854775807
byte System.Byte No 1 0 to 255
ushort System.Uint16 No 2 0 to 65535
uint System.UInt32 No 4 0 to 4294967295
ulong System.Uint64 No 8 0 to 18446744073709551615
float System.Single Yes 4 Approximately ±1.5 x 10-45 to ±3.4 x 1038 with 7 significant figures
double System.Double Yes 8 Approximately ±5.0 x 10-324 to ±1.7 x 10308 with 15 or 16 significant figures
decimal System.Decimal Yes 12 Approximately ±1.0 x 10-28 to ±7.9 x 1028 with 28 or 29 significant figures
char System.Char N/A 2 Any Unicode character (16 bit)
bool System.Boolean N/A 1 / 2 true or false