Mysql 從5.1升級到5.6安裝
轉:https://www.cnblogs.com/007sx/p/7083143.html
一、檢查系統是否安裝其他版本的MYSQL數據
#yum list installed | grep mysql
#yum -y remove mysql-libs.x86_64
二、安裝及配置
# wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm
# rpm -ivh mysql-community-release-el6-5.noarch.rpm
# yum repolist all | grep mysql
安裝MYSQL數據庫
# yum install mysql-community-server -y
設置爲開機啓動(2、3、4都是on代表開機自動啓動)
# chkconfig --list | grep mysqld
# chkconfig mysqld on
三、設置遠程root
啓動mysql
# service mysqld start
##啓動失敗報錯 ##
[root@localhost ~]# service mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]
查看log
2018-01-08 23:05:45 7253 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768 pages, max 0 (relevant if non-zero) pages!
2018-01-08 23:05:45 7253 [ERROR] InnoDB: Could not open or create the system tablespace. If you tried to add new data files to the system tablespace, and it failed here, you should now edit innodb_data_file_path in my.cnf back to what it was, and remove the new ibdata files InnoDB created in this failed attempt. InnoDB only wrote those files full of zeros, but did not yet use them in any way. But be careful: do not remove old data files which contain your precious data!
2018-01-08 23:05:45 7253 [ERROR] Plugin 'InnoDB' init function returned error.
2018-01-08 23:05:45 7253 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2018-01-08 23:05:45 7253 [ERROR] Unknown/unsupported storage engine: InnoDB
2018-01-08 23:05:45 7253 [ERROR] Aborting
檢查發現mysql的目錄下有如下文件:
[root@tserver mysql]# ls
ibdata1 ib_logfile0 ib_logfile1 mysql RPM_UPGRADE_HISTORY RPM_UPGRADE_MARKER-LAST test tserver.err
刪除了如下三個文件:
[root@tserver mysql]# rm ibdata1 ib_logfile0 ib_logfile1
rm: remove regular file `ibdata1'? yes
rm: remove regular file `ib_logfile0'? yes
rm: remove regular file `ib_logfile1'? yes
重新啓動mysql server就可以了:
cd /var/lib/mysql
[root@localhost mysql]# service mysqld start
Starting mysqld: [ OK ]
設置root密碼
# mysql_secure_installation
登陸root賬號
# mysql -u root -p 123456
##密碼報錯##
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解決方法:https://www.cnblogs.com/gumuzi/p/5711495.html
#vim /etc/my.cnf(注:windows下修改的是my.ini)
1.在[mysqld]後面任意一行添加“skip-grant-tables”用來跳過密碼驗證的過程,如下圖所示
2.接下來我們需要重啓MySQL:
/etc/init.d/mysql restart(有些用戶可能需要使用/etc/init.d/mysqld restart或service mysqld restart)
3.重啓之後輸入#mysql即可進入mysql。
4.接下來就是用sql來修改root的密碼
mysql> use mysql;
mysql> update user set password=password("你的新密碼") where user="root";
mysql> flush privileges;
mysql> quit
到這裏root賬戶就已經重置成新的密碼了。
5.編輯my.cnf,去掉剛纔添加的內容,然後重啓MySQL。大功告成!
查看mysql原本編碼:
mysql> show variables like 'character%';
設置編碼
# vi /etc/my.cnf
如下(少補):
複製代碼
[mysqld]
character-set-server=utf8
collation-server=utf8_general_ci
sql_mode='NO_ENGINE_SUBSTITUTION'
[mysql]
default-character-set = utf8
[mysql.server]
default-character-set = utf8
[mysqld_safe]
default-character-set = utf8
[client]
default-character-set = utf8
複製代碼
重啓mysql
# service mysqld restart
再次查看編碼:
複製代碼
# mysql -uroot -p
mysql> show variables like 'character%';
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)
===============================================================================================
sonarqube下載地址:https://sonarsource.bintray.com/Distribution/sonarqube/ or http://www.sonarqube.org/downloads/
SonarQube之Mysql安裝
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
震驚:蔡英文決定 為安倍「下半旗」,真的合理嗎?
SteveSapp9
2022-07-11 17:06:56
哪些因素会影响性欲?这些因素不容小觑
SteveSapp9
2022-07-04 20:32:20
台媒爆料“台版51區”興建“神秘”設施 “面積大到令人好奇”
SteveSapp9
2022-06-23 14:39:41
河北省公安廳發布關於陳某誌等涉嫌尋釁滋事、暴力毆打他人等案件偵辦進展情況的通報
LouisRodgers5773
2022-06-21 16:49:16
曼聯遇到障礙將克里斯蒂安·埃里克森帶到老特拉福德
ktn83
2022-06-18 07:55:27
如何提高性生活質量?這六個妙招快快學起來!
mugiseki2710
2022-06-17 15:34:42
UEFAチャンピオンズリーグ決勝戦、米で視聴者数が過去最高に
fikik75972
2022-06-16 23:48:20
wewerewrr werwerwer
pennyjhurd
2022-06-12 18:34:42
fds rew rewrewrewrew
mufajiqe
2022-06-12 18:04:40
Deep Lake Water Cooling System Market To Witness Huge Growth By 2030
chhidami.a.msg
2022-06-08 22:14:54
專家建議晚飯只吃七分飽,常見的胃病有哪些?
LouisRodgers5773
2022-06-08 15:16:23
肝臟不好怎麼調理?
LouisRodgers5773
2022-06-08 14:49:19
中国人民解放军的最高军事机关为中央机关为中央军事委员会
fikik75972
2022-06-08 00:31:46
台中叫/小/姐瀨tea232台中/外/約✔外拍麻豆✔校園系花✔專櫃正妹❤
lan520an109
2022-06-07 19:29:34