V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
Newyorkcity
V2EX  ›  问与答

按照 mysql 官网的 yum 安装说明给刚初始化的 centos7 系统装,mysql 无法启动,求教.

  •  
  •   Newyorkcity · 2018-05-03 15:10:41 +08:00 · 1089 次点击
    这是一个创建于 2391 天前的主题,其中的信息可能已经有所发展或是发生改变。

    服务器是刚刚初始化磁盘之后的 centos7 的阿里云服务器.
    所有的步骤都按照官网的安装教程:
    https://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html

    错误出在第四步启动 mysql 服务器 之前我感觉应该都 OK

    [root@Adam mysql]# sudo service mysqld start
    Redirecting to /bin/systemctl start  mysqld.service
    
    [root@Adam mysql]# sudo service mysqld status
    Redirecting to /bin/systemctl status  mysqld.service
    mysqld.service - MySQL Server
       Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
       Active: active (running) since Thu 2018-05-03 14:48:47 CST; 19min ago
         Docs: man:mysqld(8)
               http://dev.mysql.com/doc/refman/en/using-systemd.html
      Process: 1180 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS)
      Process: 1107 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
     Main PID: 1184 (mysqld)
       CGroup: /system.slice/mysqld.service
               └─1184 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysql...
    
    May 03 14:48:47 Adam systemd[1]: Started MySQL Server.
    May 03 15:06:53 Adam systemd[1]: Started MySQL Server.
    
    

    查看错误日志

    cat /var/log/mysqld.log
    

    得到:

    2018-05-03T06:48:40.433045Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2018-05-03T06:48:42.653691Z 0 [Warning] InnoDB: New log files created, LSN=45790
    2018-05-03T06:48:42.987991Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
    2018-05-03T06:48:43.053417Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 0500bdb0-4e9e-11e8-a47e-00163e08240e.
    2018-05-03T06:48:43.055498Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
    2018-05-03T06:48:43.055946Z 1 [Note] A temporary password is generated for root@localhost: *wGve+dHu1Y(
    2018-05-03T06:48:46.745567Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
    2018-05-03T06:48:46.747041Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.22) starting as process 1184 ...
    2018-05-03T06:48:46.750539Z 0 [Note] InnoDB: PUNCH HOLE support available
    2018-05-03T06:48:46.750562Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
    2018-05-03T06:48:46.750570Z 0 [Note] InnoDB: Uses event mutexes
    2018-05-03T06:48:46.750574Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
    2018-05-03T06:48:46.750578Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
    2018-05-03T06:48:46.750581Z 0 [Note] InnoDB: Using Linux native AIO
    2018-05-03T06:48:46.750849Z 0 [Note] InnoDB: Number of pools: 1
    2018-05-03T06:48:46.751127Z 0 [Note] InnoDB: Using CPU crc32 instructions
    2018-05-03T06:48:46.752547Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
    2018-05-03T06:48:46.763777Z 0 [Note] InnoDB: Completed initialization of buffer pool
    2018-05-03T06:48:46.766286Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
    2018-05-03T06:48:46.778460Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
    2018-05-03T06:48:46.788598Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
    2018-05-03T06:48:46.788640Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
    2018-05-03T06:48:46.994265Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
    2018-05-03T06:48:46.995082Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
    2018-05-03T06:48:46.995093Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
    2018-05-03T06:48:46.996046Z 0 [Note] InnoDB: Waiting for purge to start
    2018-05-03T06:48:47.046201Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 2589318
    2018-05-03T06:48:47.046511Z 0 [Note] Plugin 'FEDERATED' is disabled.
    2018-05-03T06:48:47.051515Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
    2018-05-03T06:48:47.054110Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180503 14:48:47
    2018-05-03T06:48:47.055609Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
    2018-05-03T06:48:47.055818Z 0 [Warning] CA certificate ca.pem is self signed.
    2018-05-03T06:48:47.057502Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
    2018-05-03T06:48:47.057539Z 0 [Note] IPv6 is available.
    2018-05-03T06:48:47.057549Z 0 [Note]   - '::' resolves to '::';
    2018-05-03T06:48:47.057570Z 0 [Note] Server socket created on IP: '::'.
    2018-05-03T06:48:47.066966Z 0 [Note] Event Scheduler: Loaded 0 events
    2018-05-03T06:48:47.067077Z 0 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.7.22'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
    

    linux 系统真是折腾..按照官网的方法安装还总是会遇上毛病 另外想问一句能解决这个问题的前辈...你们是怎么修炼到这个程度的? 谢谢

    zocome
        1
    zocome  
       2018-05-03 15:15:41 +08:00
    这有什么错误?不是告诉了你 Active: active (running) 么
    Newyorkcity
        2
    Newyorkcity  
    OP
       2018-05-03 15:17:26 +08:00
    @zocome 额?
    官方的范例说第一句的回应应该是 Starting mysqld:[ OK ]
    第二局的回应应该是 mysqld (pid 3066) is running.
    我看到这么大块代码就自然而然地觉得是失败了....
    如果是成功了为何我的输出如此与众不同...
    zocome
        3
    zocome  
       2018-05-03 15:21:05 +08:00
    centos7 的 systemd 了解一下
    jasonyang9
        4
    jasonyang9  
       2018-05-03 15:21:29 +08:00
    CentOS 7 用 systemd 来管服务了,而且 mysqld 也是跑起来的
    zocome
        5
    zocome  
       2018-05-03 15:22:47 +08:00   ❤️ 1
    官方说什么你就只看什么是吧,人家文档也没跟你说是用的 centos7
    看官方文档命令用的可能是 centos6 或者其他发行版
    jasonyang9
        6
    jasonyang9  
       2018-05-03 15:23:23 +08:00   ❤️ 1
    ```
    systemctl start mysqld
    systemctl enable mysqld
    systemctl status mysqld
    ```

    https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7
    Newyorkcity
        7
    Newyorkcity  
    OP
       2018-05-03 15:25:17 +08:00
    @zocome
    @jasonyang9
    可我已经用 yum 安装 mysql5.7 安装了一大半了...要全部推倒重新来过?
    jasonyang9
        8
    jasonyang9  
       2018-05-03 15:27:11 +08:00   ❤️ 1
    @Newyorkcity #7 不用啊,mysqld 已经跑起来了,并在监听 3306 端口
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1103 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 22:43 · PVG 06:43 · LAX 14:43 · JFK 17:43
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.