如何啓動MySql服務mysql
/etc/init.d/mysqld start service mysqld start Centos 7.x 系統 sysctl start mysqld
檢測端口是否運行sql
lsof -i :3306 netstat -lntup |grep 3306
設置或修改MySql密碼數據庫
設置密碼 mysql -uroot -ppassword -e "set passowrd for root = passowrd('passowrd')" mysqladmin -uroot passowrd "NEWPASSWORD" 更改密碼 mysqladmin -uroot passowrd oldpassowrd "NEWPASSWORD" use mysql; update user set passowrd = PASSWORD('newpassword') where user = 'root';
flush privileges; msyql 5.7以上版本修改默認密碼命令 alter user 'root'@'localhost' identified by 'root'
查看當前數據庫的字符集ide
show create database DB_NAME;
查看當前數據庫版本spa
mysql -V mysql -uroot -ppassowrd -e "use mysql;select version();"
查看當前登陸用戶code
mysql -uroot -ppassowrd -e "select user();"