1. 創(chuàng)建MySQL安裝目錄
mkdir -p app/soft/mysql
2. 進(jìn)入MySQL安裝目錄,下載,安裝
cd /app/soft/mysql/
wget http://dev.mysql.com/get/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
得到安裝包:
解壓安裝包:
查看系統(tǒng)是否自帶自帶的數(shù)據(jù)庫 mariadb
如果畫框中的內(nèi)容有,則rpm -e --nodeps XXX刪除:
rpm -e --nodeps mariadb-connector-c-3.1.11-2.oc8.1.x86_64
rpm -e --nodeps mariadb-connector-c-config-3.1.11-2.oc8.1.noarch
安裝:
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm
yum install libncurses*
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm
3. 啟動并測試連接
查看密碼:
進(jìn)入輸入密碼:
mysql -u root -p
修改密碼:
set global validate_password_policy=0;
set global validate_password_length=1;
alter user ‘root’@‘localhost’ identified by ‘你的密碼’;
刷新:
繼續(xù)執(zhí)行:
use mysql;
SELECT Host, User FROM user;
UPDATE user SET Host = ‘%’ WHERE User = ‘root’;
flush privileges;
測試連接:
成功:
MySQL忘記密碼了怎么辦?
修改配置文件:
vi /etc/my.cnf
新增: skip-grant-tables
保存退出,重啟MySQL:
service mysqld restart
登錄數(shù)據(jù)庫
mysql
修改密碼刷新權(quán)限:
use mysql;
update user set authentication_string=password('新密碼') where user='root';
flush privileges;
exit;
刪除剛剛新增: skip-grant-tables文章來源:http://www.zghlxwxcb.cn/news/detail-620856.html
重新登錄即可:文章來源地址http://www.zghlxwxcb.cn/news/detail-620856.html
mysql -uroot -p
到了這里,關(guān)于在騰訊云服務(wù)器OpenCLoudOS系統(tǒng)中安裝mysql(有圖詳解)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!