2018年5月24日 星期四

MySQL Command

安裝  mysql client
$sudo apt-get install mysql-client-5.7
' install

登入
$mysql -h 172.21.2.171 -u root -p
'mysql >
'check account  'root'@'%'

使用系統資料庫(切換schema)
mysql>use mysql ;

server 有多少帳號
mysql>select @@version;
mysql>select user,host  from mysql.user;

mysql>show databases;
'DB
mysql> use piwik;
mysql>show tables;


建立 user
mysql>create user 'matomouser'@'localhost' IDENTIFIED BY 'usermatomo';
'注意, 記得client重新連線

mysql> grant select on piwik.* to 'matomouser'@'%'; 'read

建立資料庫
mysql>create database cljdb default character set utf8 collate utf8_bin;
mysql> grant all on cljdb.* to 'clj'@'%' with grant option;

查看表格設計
mysql>describe first_table;

個人操作改密碼
mysql>set password for 'matomouser'@'localhost'='usermatomo'




沒有留言:

張貼留言