啓動和關閉數據庫mysql
/etc/init.d/mysql restart
/etc/init.d/mysql start
/etc/init.d/mysql stop
密碼登陸(登陸root用戶命令以下:)sql
mysql -uroot -p
查看在當前服務器中有多少個數據庫 數據庫
show databases;
drop database databaseName; commit;
CREATE DATABASE db_name DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
use databaseName;
show tables;
create table tableName( id int(10) NOT NULL AUTO_INCREMENT,PRIMARY KEY(id), name varchar(20) );
desc tableName;
source F:/file.sql;
select user();
exit (回車)
mysqladmin -uroot -pab12 password djg345
爲root用戶初次設置密碼服務器
mysqladmin -u root password "newpwd"
grant select,insert,update,delete on *.* to test1@\"%\" Identified by \"abc\";
DROP USER 'username'@'host';