频道栏目
首页 > 资讯 > MySQL > 正文

mysql5.7.14源码安装过程中碰到的几个问题.

16-08-25        来源:[db:作者]  
收藏   我要投稿

zabbix是目前比较有名的一款开源监控软件,想安装来学习学习。部署这套监控程序要用到数据库,zabbix支持的数据库都是些主流的,因为有很多参考文章都是以MySql为例的,所以也去了MySql网站下了源码准备也学学别人,用源码编译安装,以为按有些参考文档一个小时就能搞定,没想到碰了几个问题耽误了不少时间,今天借这个途径和大家分享下,希望能让和我差不多想法的人少走弯路。

言归正传,首先下源码,二话不说来到官方网站找linux源码,社区版的,最新的,好找到了,如截图所示:

 

 

 

 

有612.9M还好我50M宽带,一会就下完了,下完就传到虚拟机上解压,还下了CMake,没想到怎么装都报错,上网查了查别人是否有这个错误,一查有,看看也不明白所以,无从下手,又继续google搜,再看看别人怎么有人下的安装包才50多mb,奇了怪了,再去官网看看,一看还真看到不一样的地方了,见下面截图:

 

 

 

 

 

 

选了source code 果然在最下面两个看着是我需要的,好吧下来装,上传,解压,配置各种安装参数,照着别人的文章里说的继续,这次还是configure就报错了,一看是和什么boost有关的,于是又查了boost的一些资料,然后又到官网去下源码包来准备安装,很快下载下来上传解压,原以为很快搞定,没想到安装boost也有问题,没看到configure文件,看到个boostrap.sh,所以执行了这个文件,一通忙乎还是搞不定,一时不知道怎么办了。停了一会还是去官网再看看,到了下载页面又看了下,一看刚刚下载页面最后一个是 inclueds Boost Headers 而且是50几mb,和别人的有点像,所以用这个肯定错不了,于是又赶紧下,上传,解压,安装时还是报错,还是boost,再一看应该是安装参数没配。之前看到别人文章提到了这个,但指向的路径和自己的路径不一致,于是查了查自己的路径,我的解压后boost路径是/home/mysql-5.7.14/boost/boost_1_59_0/boost/, 于是cmake加上这个参数,回车键按下后满心以为不会再有问题,没想到还是报错找不到boost,一下子又呆住了,觉得路径都给了,怎么会莫名其妙找不到呢,当时就想关机结束了,这几天特别热,今天搞这个搞一头汗,不行就rpm方式安装算了。停了一会想想还是不服输,我想是不是这个路径是不是真搞错了,我猛然想到路径会不会是这个 /home/mysql-5.7.14/boost/ ,试试看,一试果然是的,一路下去make make install都可以了,虽然中间有些警告但安装还是成功了。这时又去官网看了看

 

 

感觉说的太简单了,没有把路径到哪一级说清楚,很容易让人走弯路。

我的cmake参数供大家参考:

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql \ -DMYSQL_DATADIR=/usr/local/mysql/data \ -DWITH_BOOST=/home/mysql-5.7.14/boost \ -DDEFAULT_CHARSET=utf8mb4 \ -DDEFAULT_COLLATION=utf8mb4_general_ci

接下来初始化都成功了。配了PATH。配了服务。输入mysql -uroot ,一回车错误提示又来了 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO),突然又意识到密码好像安装时没有要设置哎,感觉又要停住了,先试试mysql -uroot -p看,敲个123456 发现不行。然后又各种试。还不行,一直报错,google吧,把错误一贴,很多和我一样的错误的文章,有说在什么文件里有密码,找了又找,没有,觉得这个版本不会有。还有说什么my.cnf文件的,我的安装后根本没有,也没在其他路径找到。再看其他有的文章说要用安全模式去修改密码,于是照搬 /usr/local/mysql/bin/mysqld_safe --skip-grant-tables 启好后另起一个终端窗口,敲下mysql果然进去了,继续

[root@zabbix ~]# mysql

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.14 Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> update user set password=password('123456') where user='root';

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql>

之前看到很多解决办法都是这么搞的,为什么到我就不行了呢,找不到列,真是见鬼了,google继续,再多看看文章,找了几篇看到有一个人碰到了和我一样的问题,但解决的有复杂点,不想照搬,只好瞪着屏幕看了有差不多十分钟,感觉人家装怎么都好像很顺,怎么自己就不顺。

既然报列不存在,那就看看有没有。

mysql> desc user;

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Field | Type | Null | Key | Default | Extra |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Host | char(60) | NO | PRI | | |

| User | char(32) | NO | PRI | | |

| Select_priv | enum('N','Y') | NO | | N | |

| Insert_priv | enum('N','Y') | NO | | N | |

| Update_priv | enum('N','Y') | NO | | N | |

| Delete_priv | enum('N','Y') | NO | | N | |

| Create_priv | enum('N','Y') | NO | | N | |

| Drop_priv | enum('N','Y') | NO | | N | |

| Reload_priv | enum('N','Y') | NO | | N | |

| Shutdown_priv | enum('N','Y') | NO | | N | |

| Process_priv | enum('N','Y') | NO | | N | |

| File_priv | enum('N','Y') | NO | | N | |

| Grant_priv | enum('N','Y') | NO | | N | |

| References_priv | enum('N','Y') | NO | | N | |

| Index_priv | enum('N','Y') | NO | | N | |

| Alter_priv | enum('N','Y') | NO | | N | |

| Show_db_priv | enum('N','Y') | NO | | N | |

| Super_priv | enum('N','Y') | NO | | N | |

| Create_tmp_table_priv | enum('N','Y') | NO | | N | |

| Lock_tables_priv | enum('N','Y') | NO | | N | |

| Execute_priv | enum('N','Y') | NO | | N | |

| Repl_slave_priv | enum('N','Y') | NO | | N | |

| Repl_client_priv | enum('N','Y') | NO | | N | |

| Create_view_priv | enum('N','Y') | NO | | N | |

| Show_view_priv | enum('N','Y') | NO | | N | |

| Create_routine_priv | enum('N','Y') | NO | | N | |

| Alter_routine_priv | enum('N','Y') | NO | | N | |

| Create_user_priv | enum('N','Y') | NO | | N | |

| Event_priv | enum('N','Y') | NO | | N | |

| Trigger_priv | enum('N','Y') | NO | | N | |

| Create_tablespace_priv | enum('N','Y') | NO | | N | |

| ssl_type | enum('','ANY','X509','SPECIFIED') | NO | | | |

| ssl_cipher | blob | NO | | NULL | |

| x509_issuer | blob | NO | | NULL | |

| x509_subject | blob | NO | | NULL | |

| max_questions | int(11) unsigned | NO | | 0 | |

| max_updates | int(11) unsigned | NO | | 0 | |

| max_connections | int(11) unsigned | NO | | 0 | |

| max_user_connections | int(11) unsigned | NO | | 0 | |

| plugin | char(64) | NO | | mysql_native_password | |

| authentication_string | text | YES | | NULL | |

| password_expired | enum('N','Y') | NO | | N | |

| password_last_changed | timestamp | YES | | NULL | |

| password_lifetime | smallint(5) unsigned | YES | | NULL | |

| account_locked | enum('N','Y') | NO | | N | |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

45 rows in set (0.00 sec)

一看还真是没有,那就查下记录吧,

select * from user;

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

| Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | password_last_changed | password_lifetime | account_locked |

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

| localhost | root | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | *6EECF72127BF5A3B4326F587BD9DBEE089F3BFF9 | Y | 2016-08-18 00:00:47 | NULL | N |

| localhost | mysql.sys | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | N | 2016-08-18 00:00:48 | NULL | Y |

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

2 rows in set (0.00 sec)

突然看见有像密码的东西,和列一对比,发现一个可疑的列authentication_string

试改一下更新的列

mysql>update user set authentication_string = password('123456');

Query OK, 2 rows affected, 1 warning (0.00 sec)

Rows matched: 2 Changed: 2 Warnings: 1

再查询下,果然改了,退出试试

mysql> select * from user;

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

| Host | User | Select_priv | Insert_priv | Update_priv | Delete_priv | Create_priv | Drop_priv | Reload_priv | Shutdown_priv | Process_priv | File_priv | Grant_priv | References_priv | Index_priv | Alter_priv | Show_db_priv | Super_priv | Create_tmp_table_priv | Lock_tables_priv | Execute_priv | Repl_slave_priv | Repl_client_priv | Create_view_priv | Show_view_priv | Create_routine_priv | Alter_routine_priv | Create_user_priv | Event_priv | Trigger_priv | Create_tablespace_priv | ssl_type | ssl_cipher | x509_issuer | x509_subject | max_questions | max_updates | max_connections | max_user_connections | plugin | authentication_string | password_expired | password_last_changed | password_lifetime | account_locked |

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

| localhost | root | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | Y | | | | | 0 | 0 | 0 | 0 | mysql_native_password | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | Y | 2016-08-18 00:00:47 | NULL | N |

| localhost | mysql.sys | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | N | | | | | 0 | 0 | 0 | 0 | mysql_native_password | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | N | 2016-08-18 00:00:48 | NULL | Y |

+-----------+-----------+-------------+-------------+-------------+-------------+-------------+-----------+-------------+---------------+--------------+-----------+------------+-----------------+------------+------------+--------------+------------+-----------------------+------------------+--------------+-----------------+------------------+------------------+----------------+---------------------+--------------------+------------------+------------+--------------+------------------------+----------+------------+-------------+--------------+---------------+-------------+-----------------+----------------------+-----------------------+-------------------------------------------+------------------+-----------------------+-------------------+----------------+

2 rows in set (0.00 sec)

mysql> exit

Bye

[root@zabbix ~]# mysql -uroot -p'123456'

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.14

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement..

mysql> use mysql

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement

终于通过密码进来了,但是还是报错,晕了,怎么还有错,无奈盯着屏幕又看了几分钟,突然想到好像有个当前用户改密码的命令。

mysql> set password=password('123456');

Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> exit

Bye

[root@zabbix ~]# mysql -uroot -p'123456'

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.14 Source distribution

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql>

终于一切都搞定了。用客户端连上试了试也没问题,总算成功了。

看其他人的文章里用到了 flush privileges 改完密码刷新下权限。如果有人按我说的不行就试试刷新下。

相关TAG标签
上一篇:第一次机房收费系统
下一篇:三星:Note7供不应求,全球供货紧张
相关文章
图文推荐

关于我们 | 联系我们 | 广告服务 | 投资合作 | 版权申明 | 在线帮助 | 网站地图 | 作品发布 | Vip技术培训 | 举报中心

版权所有: 红黑联盟--致力于做实用的IT技术学习网站