Bitwise SQL Comparison
// Do a bitwise comparison in mysql
select * from table where (bit_sum & bit) = bit
Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)
select * from table where (bit_sum & bit) = bit
select * into outfile '/tmp/outfile.txt' fields terminated by ',' from my_table_name;
SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=MyISAM;') FROM information_schema.tables WHERE engine = 'InnoDB';
mysqladmin -u [user] -h localhost -p password '[new_password]'
ALTER TABLE TableName MODIFY ColumnName ColumnType NULL/NOT NULL AFTER OtherColumnName;
<?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Could not connect: ' . mysql_error()); } echo 'Connected successfully'; mysql_close($link); ?>
<?php $link = mysql_connect('localhost','mydbuser','mydbpassword'); if (!$link) { die('Could not connect to MySQL: ' . mysql_error()); } echo 'mySql Connection OK'; mysql_close($link); $dbh = new PDO('mysql:host=localhost;dbname=test','mydbuser','mydbpassword'); if ($dbh) { echo 'mysql_pdo CONNECTION OK'; } else {echo 'mysql_pdo ERROR';} ?>
mysqlimport -u username -p --columns=column_1,column_2 --fields-terminated-by=',' databasename /tmp/data_file_same_as_mysql_table_name
url : jdbc:mysql://host_name:port/dbname driver class name : com.mysql.jdbc.Driver
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist