您好,登錄后才能下訂單哦!
rpm -ivh mysql-community-common-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.13-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.13-1.el7.x86_64.rpm
mysqld --initialize
#獲取密碼
grep "root@localhost" /var/log/mysqld.log |awk -F" " '{print $NF}'
#保存密碼
echo -e "root\t$(grep "root@localhost" /var/log/mysqld.log |awk -F" " '{print $NF}')" >> /root/.mysql_passwd
3.修改mysql db的charset為utf-8
cat >> /etc/my.cnf <<EOF
collation_server = utf8_general_ci
character_set_server = utf8
default_authentication_plugin=mysql_native_password
EOF
#啟動
]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
#查看日志,ibdata1沒有寫權限
vim /var/log/mysqld.log
2018-12-26T02:51:14.894580Z 1 [ERROR] [MY-012271] [InnoDB] The innodb_system data file 'ibdata1' must be writable
2018-12-26T02:51:14.894641Z 1 [ERROR] [MY-012278] [InnoDB] The innodb_system data file 'ibdata1' must be writable
#修改所有mysql目錄及文件屬主為mysql
chown -R mysql. /var/lib/ mysql*
#再次啟動,成功
systemctl start mysqld
#查看狀態
]# systemctl status mysqld
?.mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2018-12-26 10:57:21 CST; 4min 11s ago
-- 創建賬號、分配權限
CREATE USER 'user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' WITH GRANT OPTION
-- 修改密碼,使數據庫可以連接Navicat
ALTER USER 'user'@'%' IDENTIFIED WITH mysql_native_password BY 'password';
-- 刷新權限
FLUSH PRIVILEGES;
-- 顯示賬號及權限相關信息
SHOW GRANTS FOR 'user'@'localhost';
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。