CMD MySQL - bigktmbig/MyExperienceAlgorithm GitHub Wiki

  • start run mysql command line: ->cd E:\xampp\mysql\bin
  • connect to mysql: ->mysql -h localhost -u root -p
  • show all db: ->show databases;
  • use db(db name: 'bigdb'): ->use bigdb;
  • show all tables: ->show tables;
  • show record with id = 8: select * from user where id=8;
  • update table user with type = 3: update user set type=3 where id=8;
  • show struct of table: describe [table_name](user)
  • return more records when you used "GROUP_CONCAT": $query = 'SET SESSION group_concat_max_len=1000000'; mysql_query($query);
  • set local_infile mysql -h localhost -u root -p SET GLOBAL local_infile = true; SHOW GLOBAL VARIABLES LIKE 'local_infile'; ====================================

ALTER USER 'username'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

GRANT ALL PRIVILEGES ON brse_rails.* TO 'big_admin'@'localhost';

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

mysql> FLUSH PRIVILEGES;

GRANT ALL ON brse_rails TO 'big_admin'@'localhost' BY '123';