Linux操做mysql相關命令

Ubuntu16.04安裝mysql:mysql

http://fuyong.me/2017/02/08/configuration-development-environment/sql

https://blog.csdn.net/u013929284/article/details/70230799數據庫

經常使用命令:ui

查看mysql狀態:ps -ef|grep mysqld.net

重啓mysql:/usr/sbin/mysqld restartrest

中止mysql:/usr/sbin/mysqld stopcode

啓動mysql:/usr/sbin/mysqld startblog

登錄mysql數據庫: mysql -u root -p(其中root爲用戶名,輸入該命令後,纔會讓你繼續輸入密碼) get

更新root密碼:mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';string

最新版MySQL更新root密碼:mysql> UPDATE user SET authentication_string=PASSWORD('newpassword') where USER='root';

刷新權限 :mysql> FLUSH PRIVILEGES;

退出mysql:mysql> quit

查詢全部的庫:mysql> show databases; 

進入數據庫「eduyun_2015_sp1」是庫名:mysql> use eduyun_2015_sp1;

查詢全部的表:mysql> show tables;

查詢表,進行增刪改查「ey_transcodesplit」是表:mysql> select * from ey_transcodesplit; 

退出:"exit" + 回車;

相關文章
相關標籤/搜索