SonarQube之Mysql安装

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)