輸入yum install mysql-server

按Y繼續(xù)

安裝完成,設置開機啟動Mysql,輸入 chkconfig --levels 235 mysqld on

然后啟動tomcat,輸入service mysqld start
啟動完畢,然后登錄MYsql設置密碼

輸入set password for 'root'@'localhost' = password('12345678');
來設置密碼

至此,mysql安裝完畢!然后創(chuàng)建數(shù)據(jù)庫,首先用show databases;查看數(shù)據(jù)庫

然后使用create database 數(shù)據(jù)庫名;
來創(chuàng)建數(shù)據(jù)庫,
使用grant all privileges on 數(shù)據(jù)庫名.* to root@localhost identified by ' 密碼';
給剛創(chuàng)建的數(shù)據(jù)庫分配用戶
此處分配的是超級用戶root,下圖紅色區(qū)域為數(shù)據(jù)庫名。

總結
以上所述是小編給大家介紹的在CentOS VPS上通過SSH安裝 MySQL的方法圖解,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!