V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
kmdd33
V2EX  ›  程序员

centos7 安装 mysql 卡住了,输入: sudo systemctl start mysqld 后, 光标停在那里一动不动

  •  
  •   kmdd33 · 2018-04-15 18:30:53 +08:00 · 13504 次点击
    这是一个创建于 2446 天前的主题,其中的信息可能已经有所发展或是发生改变。

    参考的教程: https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-centos-7 https://linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7/

    环境:cetnos7,openresty,已经安装好了 php7,infophp 也显示正常,之前安装了 mariadb,卸载了,现在安装 mysql5.5

    执行命令的过程:

    sudo yum install mysql-server

    Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile

    sudo systemctl start mysqld

    (输入这个命令后,光标就卡在这里了)

    请问具体的解决方案?

    24 条回复    2018-04-16 20:38:03 +08:00
    neighbads
        1
    neighbads  
       2018-04-15 18:47:04 +08:00
    你不看日志的吗。。。
    kmdd33
        2
    kmdd33  
    OP
       2018-04-15 18:49:38 +08:00
    @neighbads 请问日志目录?
    defunct9
        3
    defunct9  
       2018-04-15 18:51:38 +08:00 via iPhone   ❤️ 3
    开 ssh,我上去装
    kmdd33
        4
    kmdd33  
    OP
       2018-04-15 18:52:55 +08:00
    / var/log/mysqld.log 的日志
    @neighbads 不知道你指的是不是这个?



    180415 10:39:22 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
    180415 10:49:22 mysqld_safe Logging to '/var/log/mysqld.log'.
    180415 10:49:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    180415 10:49:22 [Note] /usr/sbin/mysqld (mysqld 5.5.59) starting as process 13415 ...
    180415 10:49:22 [Note] Plugin 'FEDERATED' is disabled.
    180415 10:49:22 InnoDB: The InnoDB memory heap is disabled
    180415 10:49:22 InnoDB: Mutexes and rw_locks use GCC atomic builtins
    180415 10:49:22 InnoDB: Compressed tables use zlib 1.2.3
    180415 10:49:22 InnoDB: Using Linux native AIO
    180415 10:49:22 InnoDB: Initializing buffer pool, size = 128.0M
    180415 10:49:22 InnoDB: Completed initialization of buffer pool
    180415 10:49:22 InnoDB: highest supported file format is Barracuda.
    180415 10:49:22 InnoDB: Waiting for the background threads to start
    180415 10:49:23 InnoDB: 5.5.59 started; log sequence number 1597945
    180415 10:49:23 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3306
    180415 10:49:23 [Note] - '0.0.0.0' resolves to '0.0.0.0';
    180415 10:49:23 [Note] Server socket created on IP: '0.0.0.0'.
    180415 10:49:23 [ERROR] Incorrect definition of table mysql.event: expected column 'sql_mode' at position 14 to have type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH'), found type set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_A
    180415 10:49:23 [ERROR] Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
    180415 10:49:23 [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.5.59' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
    wwqgtxx
        5
    wwqgtxx  
       2018-04-15 18:55:54 +08:00
    sudo journalctl -u mysqld
    kmdd33
        6
    kmdd33  
    OP
       2018-04-15 18:57:35 +08:00
    sudo journalctl -u mysqld
    -- Logs begin at Wed 2018-04-11 00:59:13 UTC, end at Sun 2018-04-15 10:56:42 UTC. --
    Apr 15 09:58:20 newoneacreland systemd[1]: Starting MySQL Community Server...
    Apr 15 09:58:21 newoneacreland mysqld_safe[31839]: 180415 09:58:21 mysqld_safe Logging to '/var/log/mysqld.log'.
    Apr 15 09:58:22 newoneacreland mysqld_safe[31839]: 180415 09:58:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Apr 15 10:08:21 newoneacreland systemd[1]: mysqld.service start-post operation timed out. Stopping.
    Apr 15 10:08:21 newoneacreland systemd[1]: Failed to start MySQL Community Server.
    Apr 15 10:08:21 newoneacreland systemd[1]: Unit mysqld.service entered failed state.
    Apr 15 10:08:21 newoneacreland systemd[1]: mysqld.service failed.
    Apr 15 10:08:22 newoneacreland systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 15 10:08:22 newoneacreland systemd[1]: Starting MySQL Community Server...
    Apr 15 10:08:22 newoneacreland mysqld_safe[2173]: 180415 10:08:22 mysqld_safe Logging to '/var/log/mysqld.log'.
    Apr 15 10:08:23 newoneacreland mysqld_safe[2173]: 180415 10:08:23 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Apr 15 10:18:22 newoneacreland systemd[1]: mysqld.service start-post operation timed out. Stopping.
    Apr 15 10:18:22 newoneacreland systemd[1]: Failed to start MySQL Community Server.
    Apr 15 10:18:22 newoneacreland systemd[1]: Unit mysqld.service entered failed state.
    Apr 15 10:18:22 newoneacreland systemd[1]: mysqld.service failed.
    Apr 15 10:18:23 newoneacreland systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 15 10:18:23 newoneacreland systemd[1]: Starting MySQL Community Server...
    Apr 15 10:18:24 newoneacreland mysqld_safe[4906]: 180415 10:18:24 mysqld_safe Logging to '/var/log/mysqld.log'.
    Apr 15 10:18:24 newoneacreland mysqld_safe[4906]: 180415 10:18:24 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Apr 15 10:28:23 newoneacreland systemd[1]: mysqld.service start-post operation timed out. Stopping.
    Apr 15 10:28:23 newoneacreland systemd[1]: Failed to start MySQL Community Server.
    Apr 15 10:28:23 newoneacreland systemd[1]: Unit mysqld.service entered failed state.
    Apr 15 10:28:23 newoneacreland systemd[1]: mysqld.service failed.
    Apr 15 10:28:24 newoneacreland systemd[1]: mysqld.service holdoff time over, scheduling restart.
    Apr 15 10:28:24 newoneacreland systemd[1]: Starting MySQL Community Server...
    Apr 15 10:28:24 newoneacreland mysqld_safe[7562]: 180415 10:28:24 mysqld_safe Logging to '/var/log/mysqld.log'.
    Apr 15 10:28:25 newoneacreland mysqld_safe[7562]: 180415 10:28:25 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    lines 1-28...skipping...
    -- Logs begin at Wed 2018-04-11 00:59:13 UTC, end at Sun 2018-04-15 10:56:42 UTC. --
    Apr 15 09:58:20 newoneacreland systemd[1]: Starting MySQL Community Server...
    Apr 15 09:58:21 newoneacreland mysqld_safe[31839]: 180415 09:58:21 mysqld_safe Logging to '/var/log/mysqld.log'.
    Apr 15 09:58:22 newoneacreland mysqld_safe[31839]: 180415 09:58:22 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
    Apr 15 10:08:21 newoneacreland systemd[1]: mysqld.service start-post operation timed out. Stopping

    @wwqgtxx
    kmdd33
        7
    kmdd33  
    OP
       2018-04-15 19:00:46 +08:00

    截图在这里,麻烦看下,谢谢 @wwqgtxx @neighbads @defunct9
    kmdd33
        8
    kmdd33  
    OP
       2018-04-15 19:05:47 +08:00


    /etc/my.cnf 的配置截图如上




    /var/log/mysqld.log 的配置截图如上

    @wwqgtxx @neighbads @defunct9
    f2f2f
        9
    f2f2f  
       2018-04-15 19:17:45 +08:00
    怎么印象里 centos7 并不支持 mysql 5.5 呀……
    LGB
        10
    LGB  
       2018-04-15 19:18:34 +08:00 via Android
    看错误日志。
    kmdd33
        11
    kmdd33  
    OP
       2018-04-15 19:30:46 +08:00
    /usr/local/openresty/nginx/logs/error.log



    @LGB
    kmdd33
        12
    kmdd33  
    OP
       2018-04-15 19:31:10 +08:00
    defunct9
        13
    defunct9  
       2018-04-15 19:48:04 +08:00 via iPhone
    猜火车🚄
    kmdd33
        14
    kmdd33  
    OP
       2018-04-15 20:17:48 +08:00
    输入 sudo journalctl -xe -u mariadb.service
    查看信息
    然后输入:
    /usr/bin/mysql_secure_installation
    按照提示 输入 enter
    然后输入 4 个 y
    然后 sudo systemctl status mysqld
    active 的状态
    sudo systemctl start mysqld
    成功

    谢谢各位
    Beebird
        15
    Beebird  
       2018-04-15 20:27:53 +08:00
    之前卸载的时候,恐怕没有移除 /var/lib/mysql,mariadb-server 和 mysql-server 是默认相同的 db 文件位置。
    zhazi
        16
    zhazi  
       2018-04-15 20:42:28 +08:00 via Android
    我猜是磁盘满了
    venpong
        17
    venpong  
       2018-04-15 22:43:32 +08:00 via Android
    建议 lnmp 一键安装
    zhjits
        18
    zhjits  
       2018-04-15 22:54:16 +08:00
    MySQL 启动日常
    sudo systemctl start mysql --no-block; sudo journalctl -xefu mysql
    这样一旦挂了你能知道发生了什么
    julyclyde
        19
    julyclyde  
       2018-04-15 22:56:22 +08:00
    @venpong 你那种一键安装是最容易出事的,因为你根本不知道它是咋运行的
    kmdd33
        20
    kmdd33  
    OP
       2018-04-16 02:14:09 +08:00
    @zhazi thanks
    keithszc
        21
    keithszc  
       2018-04-16 08:57:00 +08:00
    想问一下,在 centos7 环境下,mariadb 和 mysql 有什么区别吗?
    最近我刚好在弄个东西,卸了 mysql 装的 mariadb,一个在官方包里面,一个不在,但是用起来并没有什么区别。
    wizardoz
        22
    wizardoz  
       2018-04-16 14:10:55 +08:00
    其实 MySQL 这种应用最适合用 docker 跑了,避开操作系统兼容性问题和多版本共存问题。
    YumeMichi
        23
    YumeMichi  
       2018-04-16 18:28:51 +08:00
    @keithszc madiadb 是 mysql 的社区版
    julyclyde
        24
    julyclyde  
       2018-04-16 20:38:03 +08:00
    @wizardoz mysql 这种东西,为什么会有多版本并存以及经常更换底层操作系统的需求?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1943 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 16:19 · PVG 00:19 · LAX 08:19 · JFK 11:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.