Skip to content

Instantly share code, notes, and snippets.

@maestrofx
Last active August 26, 2016 05:28
Show Gist options
  • Save maestrofx/1f4eb64c7adc2da941c9d281f769133b to your computer and use it in GitHub Desktop.
Save maestrofx/1f4eb64c7adc2da941c9d281f769133b to your computer and use it in GitHub Desktop.
Cheatsheet Bundles

create new user and privileges;

CREATE USER username IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* to 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;

import .sql to DB:

mysql -u username -p database_name < file.sql

mysql> use db_name;
mysql> source backup-file.sql;

change user password

[false] SET PASSWORD FOR 'user-name-here'@'hostname-name-here' = PASSWORD('new-password-here');

[false] UPDATE mysql.USER SET Password=PASSWORD('new-password-here') WHERE USER='user-name-here' AND Host='host-name-here';

***Challenges

Problems#1 ERROR 13 (HY000)

mysql> LOAD DATA INFILE 'transactions.csv' INTO TABLE transactions FIELDS TERMINATED by ',' LINES TERMINATED BY '\r\n' IGNORE 1 LINES (chain, dept, category, company, brand, date, productsize, productmeasure, purchasequantity, purchaseamount );
ERROR 13 (HY000): Can't get stat of '/var/lib/mysql/transactions/transactions.csv' (Errcode: 2)

ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment