MySQL - bit datatype
a) This type will be used to store true / false information. (false will be stored as value 1 and true value stored as 2)
b) eg: to update bit value (true / false) : UPDATE SET column = TRUE;
c) To view the bit datatype information in command prompt type column_name + 1
eg query : SELECT columnName + 1, tableName.* from tableName; (columnName is a bit data type column).
INSERT statement from SELECT statement
eg : INSERT INTO operation_processor (processor_id , operation_id)
VALUES(1, (SELECT operation_id FROM operation WHERE production_system_template_id = 3 AND name = 'AreaCodePull'));
MySQL Workbench :
If you want to do ER Diagram or Querying database use MySQL WorkBench. Its very nice. You can do "Reverse Engineering" also under database menu. This will give you ER diagram for the existing database or tables.
MySQLImport - Import file directly into table.
-------------------------------------------------
mysqlimport --compress --fields-optionally-enclosed-by="\"" --fields-terminated-by=, --ignore-lines=1 --lines-terminated-by="\n" --local -uusername -ppwd -hhost db_name /path/fileName.csv
You can use REPLACE for import based on unique key for update.
Source.csv is tableName.csv
ERROR 1449 (HY000) at line 13718: The user specified as a definer ('username'@'%') does not exist
To Revoke permission
REVOKE REFERENCES ON `jabord_dev_db`.* FROM 'jabord_user'@'%'
If you upgrade your mysql from lower version to higher try "mysql_upgrade" to avoid corrupted table issue.
http://forge.mysql.com/wiki/Top10SQLPerformanceTips
MySQL Install 5.5
a) This type will be used to store true / false information. (false will be stored as value 1 and true value stored as 2)
b) eg: to update bit value (true / false) : UPDATE
c) To view the bit datatype information in command prompt type column_name + 1
eg query : SELECT columnName + 1, tableName.* from tableName; (columnName is a bit data type column).
INSERT statement from SELECT statement
eg : INSERT INTO operation_processor (processor_id , operation_id)
VALUES(1, (SELECT operation_id FROM operation WHERE production_system_template_id = 3 AND name = 'AreaCodePull'));
MySQL Workbench :
If you want to do ER Diagram or Querying database use MySQL WorkBench. Its very nice. You can do "Reverse Engineering" also under database menu. This will give you ER diagram for the existing database or tables.
MySQLImport - Import file directly into table.
-------------------------------------------------
mysqlimport --compress --fields-optionally-enclosed-by="\"" --fields-terminated-by=, --ignore-lines=1 --lines-terminated-by="\n" --local -uusername -ppwd -hhost db_name /path/fileName.csv
You can use REPLACE for import based on unique key for update.
Source.csv is tableName.csv
ERROR 1449 (HY000) at line 13718: The user specified as a definer ('username'@'%') does not exist
CREATE USER 'user'@'localhost' IDENTIFIED BY 'user';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
GRANT SELECT, SHOW VIEW ON dbame.`table` to 'user_name'@`%`;
To Revoke permission
REVOKE REFERENCES ON `jabord_dev_db`.* FROM 'jabord_user'@'%'
If you upgrade your mysql from lower version to higher try "mysql_upgrade" to avoid corrupted table issue.
http://forge.mysql.com/wiki/Top10SQLPerformanceTips
MySQL Install 5.5
sudo apt-get purge mysql-server
sudo apt-get purge mysql-client
sudo apt-get purge mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -fr /var/lib/mysql
sudo wget http://mirrors.ukfast.co.uk/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-server-5.5.14-1.linux2.6.x86_64.rpm
sudo wget http://mirrors.ukfast.co.uk/sites/ftp.mysql.com/Downloads/MySQL-5.5/MySQL-client-5.5.14-1.linux2.6.x86_64.rpm
sudo apt-get install alien
sudo alien -i MySQL-server-5.5.14-1.linux2.6.x86_64.rpm --scripts
sudo alien -i MySQL-client-5.5.14-1.linux2.6.x86_64.rpm --scripts
sudo apt-get install libaio1 libaio-dev
sudo /usr/sbin/mysqld --skip-grant &
sudo /etc/init.d/mysql start
Before command failure :
ALTER TABLE tableName ADD column columnName dataType primary key auto_increment BEFORE secondColumnName;
Above command may fail. Because you cannot add first column with 'before' command. Use FIRST replacing BEFORE keyword and you should be good