国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

Linux 安裝mysql 5.7.21 可能遇到的問題歸類

2024-07-24 12:32:30
字體:
來源:轉載
供稿:網友
       Linux 安裝mysql 5.7.21 可能遇到的問題歸類:

1、Done with "file /usr/share/mysql/czech/errmsg.sys from install of mysql-community-common-5.7.9-1.el6
 
       解決方案:刪除原來的包,重新安裝。
yum -y remove mysql-libs-*
 
2、安裝數據庫 初始化(這里是以root身份執行的):bin/mysqld --initialize --user=mysql
 
報錯 [ERROR] --initialize specified but the data directory has files in  it. Aborting.
解決方案:密碼初始化不成功  修改初始化密碼
方法一:
# /etc/init.d/mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# /etc/init.d/mysqld restart
# mysql -uroot -p
Enter password: <輸入新設的密碼newpassword>
mysql>
注意 【’newpassword’   ’root’  】
ERROR 1054 (42S22): Unknown column '’root’' in 'where clause'
將單引號更新為雙引號
 
注意 【Password】
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
mysql> ERROR 1054 (42S22): Unknown column 'password' in 'field list'
錯誤原因:mysql數據庫下已經沒有password這個字段了,password字段改成了authentication_string。
update mysql.user set authentication_string=PASSWORD('password') where User='root';
 
3、啟動數據庫服務 MySQL Daemon failed to start.  服務啟動失敗
3.1、查看mysqld的log文件
# less /var/log/mysqld.log
/usr/libexec/mysqld: Can't change dir to ‘XXX' (Errcode: 13)
3.2、首先是查看數據庫日志
mysqld started
[Warning] Can't create test file xxx.lower-test
[Warning] Can't create test file xxx.lower-test
/usr/libexec/mysqld: Can't change dir to '/xxx' (Errcode: 13)
[ERROR] Aborting
首先檢查數據目錄和日志目錄的權限和所屬用戶,權限和所屬用戶都沒問題,那應該是SELINUX的權限限制了。
3.3、先查看當前配置信息.
# getenforce
Enforcing
就表明SELinux已經啟用.只需要關閉即可。
關閉方法:
#setenforce 0 (0|1 開|關)
或者
setsebool ftpd_disable_trans 1
命令也可以.
3.4、查查數據庫日志會出現
mysqld started
2018-04-17T03:48:30.343457Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
2018-04-17T03:48:30.345407Z 0 [ERROR] Aborting
錯誤:Please read "Security" section of the manual to find out how to run mysqld as root!
根據提示,查了 /opt/redmine-1.2.1-1/mysql/docs/mysql.info的Security部分,發現是因為MySQL為了安全,不希望root用戶直接啟動mysql。
解決方案
1、root用戶進行強制啟動;在啟動過程中,加入參數:--user=root  【service mysqld start --user=root】
2、修改  /etc/init.d/mysqld  137
$exec $MYSQLD_OPTS --datadir="$datadir" --socket="$socketfile" /
                --pid-file="$mypidfile" /
                --basedir=/usr --user=mysql $extra_opts >/dev/null &
        safe_pid=$!
將mysql 更新為  root
 
4、登錄數據庫報錯ERROR 1820 (HY000): You must reset your password using ALTER USER statement befo re executing this statement.直接執行:
set password=password('密碼');
 
5、遠程登錄報錯 Host is not allowed to connect to this MySQL server先說說這個錯誤,其實就是我們的MySQL不允許遠程登錄,所以遠程登錄失敗了,
解決方法如下:
1. 在裝有MySQL的機器上登錄MySQL mysql -u root -p密碼
2. 執行use mysql;
3. 執行update user set host = '%' where user = 'root';這一句執行完可能會報錯,不用管它。
4. 執行FLUSH PRIVILEGES;
經過上面4步,就可以解決這個問題了。
 
注: 第四步是刷新MySQL的權限相關表,一定不要忘了,我第一次的時候沒有執行第四步,結果一直不成功,最后才找到這個原因。

(編輯:武林網)

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 习水县| 郸城县| 理塘县| 荆门市| 栾川县| 禹州市| 辽中县| 鲁甸县| 金坛市| 新乡县| 财经| 济源市| 鄱阳县| 星子县| 增城市| 开江县| 黑河市| 平顶山市| 明光市| 环江| 松滋市| 巴马| 晋州市| 新化县| 山东| 三门县| 遂溪县| 荥经县| 韶山市| 永福县| 定陶县| 冕宁县| 旬邑县| 巫溪县| 横峰县| 正安县| 萨迦县| 临海市| 墨江| 肇源县| 金川县|