select database() 查看當前所在數據庫:mysql
show tables 查看當前數據庫的表linux
配置遠程mysql server能夠被訪問:
在 /etc/mysql/mysql.conf.d/mysqld.cnf找到bind-address = 127.0.0.1
註釋掉這行,如:#bind-address = 127.0.0.1
或者改成: bind-address = 0.0.0.0
容許任意IP訪問;
或者本身指定一個IP地址。sql
重啓 /etc/init.d/mysql restart數據庫
受權用戶能進行遠程鏈接
grant all privileges on . to root@"%" identified by "password" with grant option;ide
flush privileges;rest
第一行命令:第一個表明數據庫名;第二個表明表名,全部數據庫裏的全部表都受權給root。「%」:表示受權的用戶IP能夠指定,這裏表明任意的IP地址都能訪問MySQL數據庫 根據指定的密碼 「password」code
linux下查看mysql是否啓動:
使用命令 # service mysqld status 或者 # service mysql status 命令來查看mysql 的啓動狀態
若是是 mysqld is stopped 那就說明mysql服務是中止狀態,
若是是 mysqld is running 那就說明mysql服務是啓動狀態 server