Skip to content

Instantly share code, notes, and snippets.

@nobitagit
Last active August 1, 2016 16:23
Show Gist options
  • Save nobitagit/83c805618905fe98ee84c98ed3c738b5 to your computer and use it in GitHub Desktop.
Save nobitagit/83c805618905fe98ee84c98ed3c738b5 to your computer and use it in GitHub Desktop.
mysql.server start
mysql -u root -p
-> Enter password: password
# if a connection problem arises try this solution http://stackoverflow.com/a/25650062/1446845 but rather than editing the phpini file symlink the .sock files
# as explained here https://www.dokimay.com/index.php/tech-tips/10-mac-osx/8-installing-phpmyadmin-on-localhost-mac-osx-10-8 and here http://stackoverflow.com/a/9384672/1446845
SHOW DATABASES; #list dbs
show tables from my_db; #list tables for specified db
select * from portfolios; #view a certain table
ALTER TABLE users DROP COLUMN cash; # drop specified column
# to add fulltext search to multiple coulmns
ALTER TABLE places ADD FULLTEXT place_name__admin_name1__admin_name2__INDEX (place_name, admin_name1, admin_name2);
# content_title_keywords_ndx is the name of the index
# place_name, admin_name1, admin_name2 are the columns we want to index
# then we can perform a search like so matching the 3 columns
SELECT * FROM places WHERE Match(place_name, admin_name1, admin_name2) Against("Anto*" IN BOOLEAN MODE);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment