首页   注册   登录
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  程序员

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

  •  
  •   kmdd33 · 94 天前 · 2480 次点击
    这是一个创建于 94 天前的主题,其中的信息可能已经有所发展或是发生改变。

    参考的教程: 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
        1
    neighbads   94 天前
    你不看日志的吗。。。
        2
    kmdd33   94 天前
    @neighbads 请问日志目录?
        3
    defunct9   94 天前 via iPhone   ♥ 3
    开 ssh,我上去装
        4
    kmdd33   94 天前
    / 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)
        5
    wwqgtxx   94 天前
    sudo journalctl -u mysqld
        6
    kmdd33   94 天前
    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
        7
    kmdd33   94 天前

    截图在这里,麻烦看下,谢谢 @wwqgtxx @neighbads @defunct9
        8
    kmdd33   94 天前


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




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

    @wwqgtxx @neighbads @defunct9
        9
    f2f2f   94 天前
    怎么印象里 centos7 并不支持 mysql 5.5 呀……
        10
    LGB   94 天前 via Android
    看错误日志。
        11
    kmdd33   94 天前
    /usr/local/openresty/nginx/logs/error.log



    @LGB
        12
    kmdd33   94 天前
        13
    defunct9   94 天前 via iPhone
    猜火车🚄
        14
    kmdd33   94 天前
    输入 sudo journalctl -xe -u mariadb.service
    查看信息
    然后输入:
    /usr/bin/mysql_secure_installation
    按照提示 输入 enter
    然后输入 4 个 y
    然后 sudo systemctl status mysqld
    active 的状态
    sudo systemctl start mysqld
    成功

    谢谢各位
        15
    Beebird   94 天前
    之前卸载的时候,恐怕没有移除 /var/lib/mysql,mariadb-server 和 mysql-server 是默认相同的 db 文件位置。
        16
    zhazi   94 天前 via Android
    我猜是磁盘满了
        17
    venpong   94 天前 via Android
    建议 lnmp 一键安装
        18
    zhjits   94 天前
    MySQL 启动日常
    sudo systemctl start mysql --no-block; sudo journalctl -xefu mysql
    这样一旦挂了你能知道发生了什么
        19
    julyclyde   94 天前
    @venpong 你那种一键安装是最容易出事的,因为你根本不知道它是咋运行的
        20
    kmdd33   93 天前
    @zhazi thanks
        21
    keithszc   93 天前
    想问一下,在 centos7 环境下,mariadb 和 mysql 有什么区别吗?
    最近我刚好在弄个东西,卸了 mysql 装的 mariadb,一个在官方包里面,一个不在,但是用起来并没有什么区别。
        22
    wizardoz   93 天前
    其实 MySQL 这种应用最适合用 docker 跑了,避开操作系统兼容性问题和多版本共存问题。
        23
    YumeMichi   93 天前
    @keithszc madiadb 是 mysql 的社区版
        24
    julyclyde   93 天前
    @wizardoz mysql 这种东西,为什么会有多版本并存以及经常更换底层操作系统的需求?
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   鸣谢   ·   实用小工具   ·   1575 人在线   最高记录 3541   ·  
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.1 · 23ms · UTC 16:16 · PVG 00:16 · LAX 09:16 · JFK 12:16
    ♥ Do have faith in what you're doing.
    沪ICP备16043287号-1