mysql service mysql restart 启动失败

kali linux 64位,通过一键安装包安装了LAMP
mysql安装的位置在/web/server/mysql ,系统启动后,所有服务运行正常
但是通过service mysql restart 启动失败
提示:/etc/init.d/mysql:WARING:/etc/mysql/my.cnf cannot be read See README.warnn.gz...
而/etc/ 下根本没有mysql文件夹,只有一个mysql.bak
每次停止mysql后,没办法启动,只能重启电脑
这种情况该怎么办呢?

2个回答

用sudo权限,试试呢。

 sudo service mysql restart 
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
service mysqld retart 不能启动时是什么情况?

![图片说明](https://img-ask.csdn.net/upload/201501/11/1420982563_75909.png) 用service mysql restart 是可以的 但是service mysqld restart 是不可以的不知道是哪里出现了问题 ??

Ubuntu16.04 修改mysql 数据存储目录datadir 启动失败

Ubuntu16.04 修改mysql 数据存储目录datadir 启动失败 ,网上的各种方法都已经尝试,但是还是没有启动成功请教各位大神!!!!! 修改步骤 ## 创建 迁移文件夹 > cd /mnt > mkdir lib > cd lib && mkdir mysqldata > 数据存放在 /mnt/lib/mysqldata 修改所属用户 和所属用户组为 msyql > sudo chown -vR mysql:mysql /mnt/lib/mysqldata 修改权限 > sudo chmod -vR 700 /mnt/lib/mysqldata ### 迁移文件 停止服务 > sudo /etc/init.d/mysql stop 迁移数据 > cp -av /var/lib/mysql/* /mnt/lib/mysqldata # vim /etc/mysql/mysql.conf.d/mysqld.cnf 将 [mysqld] 组下的 datadir改为: datadir = /mnt/lib/mysqldata sudo vim /etc/apparmor.d/usr.sbin.mysqld 找到其中的 /var/lib/mysql/ r, /var/lib/mysql/** rwk, 两行权限声明,可以在前面加上#好注释掉。然后对照格式,加入新路径的权限声明: /mnt/lib/mysqldata/ r, /mnt/lib/mysqldata/** rwk 重启服务 配置文件修改成功后就可以重启数据库,重启数据库之前需要先重新载入apparmor配置文件,使用下面命令重新载入: > sudo /etc/init.d/apparmor restart >sudo /etc/init.d/mysql start 重启的时候 Starting mysql (via systemctl): mysql.serviceJob for mysql.service failed because the control process exited with error code. See "systemctl status mysql.service" and "journalctl -xe" for details. failed! root@iZm5e472vz1trxejt8m5akZ:/etc/mysql# systemctl status mysql.service ● mysql.service - MySQL Community Server Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled) Active: active (running) since Sat 2018-06-23 00:55:37 CST; 25s ago Process: 13418 ExecStartPost=/usr/share/mysql/mysql-systemd-start post (code=exited, status=0/SUCCESS) Process: 13408 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS) Main PID: 13417 (mysqld) CGroup: /system.slice/mysql.service └─13417 /usr/sbin/mysqld . 配置文件 内容 ``` # # The MySQL database server configuration file. # # You can copy this to one of: # - "/etc/mysql/my.cnf" to set global options, # - "~/.my.cnf" to set user-specific options. # # One can use all long options that the program supports. # Run program with --help to get a list of available options and with # --print-defaults to see which it would actually understand and use. # # For explanations see # http://dev.mysql.com/doc/mysql/en/server-system-variables.html # This will be passed to all mysql clients # It has been reported that passwords should be enclosed with ticks/quotes # escpecially if they contain "#" chars... # Remember to edit /etc/mysql/debian.cnf when changing the socket location. # Here is entries for some specific programs # The following values assume you have at least 32M ram [mysqld_safe] socket = /var/run/mysqld/mysqld.sock nice = 0 [mysqld] # # * Basic Settings # user = mysql pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock port = 3306 basedir = /usr # datadir = /var/lib/mysql datadir = /mnt/lib/mysqldata tmpdir = /tmp lc-messages-dir = /usr/share/mysql skip-external-locking # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 0.0.0.0 # # * Fine Tuning # key_buffer_size = 16M max_allowed_packet = 16M thread_stack = 192K thread_cache_size = 8 # This replaces the startup script and checks MyISAM tables if needed # the first time they are touched myisam-recover-options = BACKUP #max_connections = 100 #table_cache = 64 #thread_concurrency = 10 # # * Query Cache Configuration # query_cache_limit = 1M query_cache_size = 16M # # * Logging and Replication # # Both location gets rotated by the cronjob. # Be aware that this log type is a performance killer. # As of 5.1 you can enable the log at runtime! #general_log_file = /var/log/mysql/mysql.log #general_log = 1 # # Error log - should be very few entries. # log_error = /var/log/mysql/error.log # # Here you can see queries with especially long duration #log_slow_queries = /var/log/mysql/mysql-slow.log #long_query_time = 2 #log-queries-not-using-indexes # # The following can be used as easy to replay backup logs or for replication. # note: if you are setting up a replication slave, see README.Debian about # other settings you may need to change. #server-id = 1 #log_bin = /var/log/mysql/mysql-bin.log expire_logs_days = 10 max_binlog_size = 100M #binlog_do_db = include_database_name #binlog_ignore_db = include_database_name # # * InnoDB # # InnoDB is enabled by default with a 10MB datafile in /var/lib/mysql/. # Read the manual for more InnoDB related options. There are many! # # * Security Features # # Read the manual, too, if you want chroot! # chroot = /var/lib/mysql/ # # For generating SSL certificates I recommend the OpenSSL GUI "tinyca". # # ssl-ca=/etc/mysql/cacert.pem # ssl-cert=/etc/mysql/server-cert.pem # ssl-key=/etc/mysql/server-key.pem ```

manjaro下安装了mysql8,之前都运行正常,突然启动不了了,应该怎么查?

[NBC1700155 mysql]# systemctl start mysqld Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. [NBC1700155 mysql]# systemctl status mysqld ● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pres> Active: failed (Result: exit-code) since Wed 2019-11-06 21:14:40 CST; 8s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 3107 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0> Process: 3128 ExecStart=/usr/bin/mysqld $MYSQLD_OPTS (code=exited, status=127) Main PID: 3128 (code=exited, status=127) 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Service RestartSec=100m> 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Scheduled restart job, > 11月 06 21:14:40 NBC1700155 systemd[1]: Stopped MySQL Server. 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Start request repeated > 11月 06 21:14:40 NBC1700155 systemd[1]: mysqld.service: Failed with result 'exi> 11月 06 21:14:40 NBC1700155 systemd[1]: Failed to start MySQL Server. [NBC1700155 mysql]#

mysql服务启动很慢,什么原因

mysql版本5.7.14,服务第一次启动很慢,再重启的话就很快,不知道什么原因,百度上的方法试了 个遍,还是不行。。。

阿里云 centos7 mysql服务无法停止,提示Failed to stop mysqld.service: Unit mysqld.service not loaded.

很久没管过的一台服务器,现在想要升级做个备份,结果无法停止mysql了..... 目前在这台服务器上跑的网站一切都正常 service mysqld stop 提示: Redirecting to /bin/systemctl stop mysqld.service Failed to stop mysqld.service: Unit mysqld.service not loaded. 搜遍了网络也没同样问题的,求大神解答,万分感谢

mysql 5.6 Fabric添加主节点失败,日志如下,求高手解答,不胜感激!

[root@localhost log]# service mysql restart Shutting down MySQL... SUCCESS! Starting MySQL. SUCCESS! [root@localhost log]# mysqlfabric manage stop Password for admin: Fabric UUID: 5ca1ab1e-a007-feed-f00d-cab3fe13249e Time-To-Live: 1 Success (empty result set) [root@localhost log]# mysqlfabric group add my_group 192.168.15.140:3307 Password for admin: Fabric UUID: 5ca1ab1e-a007-feed-f00d-cab3fe13249e Time-To-Live: 1 **ServerError: The MySQL Server instance used as Fabric's state store cannot be managed.**

mysql 6.0安装结束后 start service前面打个叉❌ 新手中的新手求解

如题 网上方法都试过了 还能是什么问题 愁人啊 注册表也删过了 sc delete mysql 也用过了 重启开机也弄了 就是不好使啊!!!大神来一个 分分钟搞定下吧

服务器断电后mysql无法启动

因意外导致服务器断电,重启后发现mysql起不来了 ``` [root@cacti ~]# service mysqld restart 停止 mysqld: [确定] MySQL Daemon failed to start. 正在启动 mysqld: [失败] ``` 查看日志: ``` [root@cacti ~]# tail -100 /var/log/mysqld.log 150520 12:21:12 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql 150520 12:21:12 InnoDB: Initializing buffer pool, size = 8.0M 150520 12:21:12 InnoDB: Completed initialization of buffer pool InnoDB: Log scan progressed past the checkpoint lsn 2 1552263436 150520 12:21:12 InnoDB: Database was not shut down normally! InnoDB: Starting crash recovery. InnoDB: Reading tablespace information from the .ibd files... InnoDB: Restoring possible half-written data pages from the doublewrite InnoDB: buffer... 150520 12:21:12 InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percents: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 206. InnoDB: You may have to recover from a backup. 150520 12:21:12 InnoDB: Page dump in ascii and hex (16384 bytes): len 16384; hex cc507667000000ce0000000000000000000000025cabb0bc000200000000000000000000000000021e751eb0ffffffff0000ffffffff000000021dbb0000000000000002123200000001000000ce002c000000ce002c000000000304a196000000000304a1970001011000000000000000000000014....... .... .... .... oDB: End of page dump 150520 12:21:12 InnoDB: Page checksum 3392922109, prior-to-4.0.14-form checksum 1831220034 InnoDB: stored checksum 3427825255, prior-to-4.0.14-form stored checksum 2455963898 InnoDB: Page lsn 2 1554755772, low 4 bytes of lsn at page end 1556408857 InnoDB: Page number (if stored to page already) 206, InnoDB: space id (if created with >= MySQL-4.1.1 and stored already) 0 InnoDB: Page may be an update undo log page InnoDB: Database page corruption on disk or a failed InnoDB: file read of page 206. InnoDB: You may have to recover from a backup. InnoDB: It is also possible that your operating InnoDB: system has corrupted its own file cache InnoDB: and rebooting your computer removes the InnoDB: error. InnoDB: If the corrupt page is an index page InnoDB: you can also try to fix the corruption InnoDB: by dumping, dropping, and reimporting InnoDB: the corrupt table. You can use CHECK InnoDB: TABLE to scan your table for corruption. InnoDB: See also http://dev.mysql.com/doc/refman/5.1/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. InnoDB: Ending processing because of a corrupt database page. 150520 12:21:12 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended ``` mysql新手一个,希望大家能帮帮忙分析下,谢谢!

linux mysql 启动不了

Failed to start mysqld.service: Unit not found. 我是新手 第一次接触linux 服务器

win10 mysql 5.7.17 安装卡在starting server

win 10 mysql5.7.17 安装卡在starting server,网上找了很多方法,比如用本地系统账户手动启动,或者删除注册表重装,还有更改my.ini,都没有用。 按照网上的说法也没有找到.err文件,结果发现这个文件直接显示在安装界面上了(尴尬) 下面是log Beginning configuration step: Stopping Server [if necessary] Ended configuration step: Stopping Server [if necessary] Beginning configuration step: Writing configuration file Ended configuration step: Writing configuration file Beginning configuration step: Updating firewall Adding firewall rule for MySQL57 on port 3306. Successfully added firewall rule. Ended configuration step: Updating firewall Beginning configuration step: Adjusting Windows service [if necessary] Attempting to grant Network Service require filesystem permissions. Granted permissions. Adding new service New service added Ended configuration step: Adjusting Windows service [if necessary] Beginning configuration step: Initializing Database [if necessary] Deleting Data folder shipped Attempting to run MySQL Server with --Initialize-insecure Running process: F:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="F:\Program Files\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console Waiting for the server stops: F:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="F:\Program Files\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console 2017-09-18T13:50:15.638257Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-09-18T13:50:15.638257Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2017-09-18T13:50:25.360635Z 0 [Warning] InnoDB: New log files created, LSN=45790 2017-09-18T13:50:25.907212Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. mysqld: File '.\褰煎コ銇█銇勩伨銇?slow.log' not found (Errcode: 2 - No such file or directory) 2017-09-18T13:50:26.125979Z 0 [ERROR] Could not use 褰煎コ銇█銇勩伨銇?slow.log for logging (error 2 - No such file or directory). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL SLOW_QUERY_LOG=ON" or restart the MySQL server. 2017-09-18T13:50:26.141566Z 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: 530d3483-9c78-11e7-9ec9-54e1ad2321ad. 2017-09-18T13:50:26.188451Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-09-18T13:50:26.204073Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. Finished initialize database Ended configuration step: Initializing Database [if necessary] Beginning configuration step: Starting Server Starting MySQL as a service 路径有问题,是乱码,但是我的安装路径是全英文的,mysqld能在文件夹下找到,在dos下也启动不了。 使用它的默认路径也还是这个问题。

MySql安装一直卡在starting serverq 求解答 贴上log

Beginning configuration step: Stopping Server [if necessary] Ended configuration step: Stopping Server [if necessary] Beginning configuration step: Writing configuration file Ended configuration step: Writing configuration file Beginning configuration step: Updating firewall Adding firewall rule for MySQL57 on port 3306. Successfully added firewall rule. Ended configuration step: Updating firewall Beginning configuration step: Adjusting Windows service [if necessary] Attempting to grant Network Service require filesystem permissions. Granted permissions. Adding new service New service added Ended configuration step: Adjusting Windows service [if necessary] Beginning configuration step: Initializing Database [if necessary] Deleting Data folder shipped Attempting to run MySQL Server with --Initialize-insecure Running process: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console Waiting for the server stops: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --initialize-insecure=on --console 2017-09-19T18:14:08.853281Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2017-09-19T18:14:08.853281Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2017-09-19T18:14:14.079270Z 0 [Warning] InnoDB: New log files created, LSN=45790 2017-09-19T18:14:15.654948Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. mysqld: File '.\绁栧帤涔?slow.log' not found (Errcode: 2 - No such file or directory) 2017-09-19T18:14:15.951298Z 0 [ERROR] Could not use 绁栧帤涔?slow.log for logging (error 2 - No such file or directory). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL SLOW_QUERY_LOG=ON" or restart the MySQL server. 2017-09-19T18:14:15.966926Z 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: 58c698a0-9d66-11e7-ab89-201a06371a86. 2017-09-19T18:14:16.138545Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2017-09-19T18:14:16.388094Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. Finished initialize database Ended configuration step: Initializing Database [if necessary] Beginning configuration step: Starting Server Starting MySQL as a service

启动服务的时候总是出现这个提示Redirecting to /bin/systemctl start httpd.service

**我的系统是fedora20,启动服务(service httpd start)的时候总是会显示以下的错误Redirecting to /bin/systemctl start httpd.service,在网上查了一些资料,照着去做,修改了主机名,也关掉了selinux和检查了iptables,但是还是不行,希望了解这方面知识的您可以给出一些可行的建议,谢谢。**

无法连接mysql和php

<div class="post-text" itemprop="text"> <p>Having this lamp docker setup (Im a sort of docker newbie):</p> <p><strong>docker-compose.yml</strong></p> <pre><code>version: '2' services: webserver: build: . ports: - "8080:80" - "443:443" volumes: - ./:/var/www/html links: - db db: image: mysql:5.6 ports: - "3306:3306" volumes: - /var/lib/mysql environment: - MYSQL_ROOT_PASSWORD=adminpasswd - MYSQL_DATABASE=se_racken_dev phpmyadmin: image: phpmyadmin/phpmyadmin:latest ports: - "88:80" links: - db:db </code></pre> <p><strong>Dockerfile</strong></p> <pre><code>FROM php:5.6-apache RUN apt-get update -y &amp;&amp; apt-get install -y libpng-dev curl libcurl4-openssl-dev RUN docker-php-ext-install pdo pdo_mysql gd curl RUN a2enmod rewrite RUN service apache2 restart </code></pre> <p>Just cant get my local environment to work.</p> <p><strong>Get this error message at localhost:8088:</strong></p> <blockquote> <p>SQLSTATE[HY000] [2002] No such file or directory</p> </blockquote> <p>How can I configure my docker setup to get past this connection problem?</p> <p>Got some hints here: <a href="https://stackoverflow.com/questions/2412009/starting-with-zend-tutorial-zend-db-adapter-throws-exception-sqlstatehy000">Starting with Zend Tutorial - Zend_DB_Adapter throws Exception: "SQLSTATE[HY000] [2002] No such file or directory"</a></p> <p>Do I need to install vim and do what they suggest in above or can I solve it in my docker files?</p> </div>

main函数return -1,服务设置了Restart=on-failure

自己项目上的进程xxx.service上设置了Restart=on-failure,但是实际上测试发现main函数中return -1后进程未自动重启,有人知道是为什么吗? 系统是centos7.0.1406

MySQL5.7.21 msi安装的问题

安装时候到启动服务时候,服务启动不了,![图片说明](https://img-ask.csdn.net/upload/201802/23/1519380310_610360.png)![图片说明](https://img-ask.csdn.net/upload/201802/23/1519380339_64588.png) Beginning configuration step: Stopping Server [if necessary] Ended configuration step: Stopping Server [if necessary] Beginning configuration step: Writing configuration file Ended configuration step: Writing configuration file Beginning configuration step: Updating firewall Attempting to create firewall rule with command: netsh.exe firewall delete portopening protocol=TCP port=3306 profile=ALL Adding firewall rule for MySQL on port 3306. Attempting to create firewall rule with command: netsh.exe firewall add portopening protocol=TCP port=3306 profile=ALL name=MySQL mode=ENABLE scope=ALL Successfully added firewall rule. Ended configuration step: Updating firewall Beginning configuration step: Adjusting Windows service [if necessary] Attempting to grant Network Service require filesystem permissions. Granted permissions. Adding new service New service added Ended configuration step: Adjusting Windows service [if necessary] Beginning configuration step: Initializing Database [if necessary] Deleting the data directory from a previous (failed) configuration... Attempting to run MySQL Server with --initialize-insecure option... Starting process for MySQL Server 5.7.21... Starting process with command: C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe --defaults-file="C:\ProgramData\MySQL\MySQL Server 5.7\my.ini" --console --initialize-insecure=on... 2018-02-23T09:51:19.100633Z 0 [Warning] option 'read_buffer_size': unsigned value 0 adjusted to 8192 2018-02-23T09:51:19.100738Z 0 [Warning] option 'read_rnd_buffer_size': unsigned value 0 adjusted to 1 2018-02-23T09:51:19.100841Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2018-02-23T09:51:19.100862Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2018-02-23T09:51:21.155766Z 0 [Warning] InnoDB: New log files created, LSN=45790 2018-02-23T09:51:21.636909Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. mysqld: File '.\鍒樹繆宀?slow.log' not found (Errcode: 2 - No such file or directory) 2018-02-23T09:51:21.886656Z 0 [ERROR] Could not use 鍒樹繆宀?slow.log for logging (error 2 - No such file or directory). Turning logging off for the server process. To turn it on again: fix the cause, then either restart the query logging by using "SET GLOBAL SLOW_QUERY_LOG=ON" or restart the MySQL server. 2018-02-23T09:51:21.892115Z 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: 1a7a0638-187f-11e8-b26e-3417eb5b6dd1. 2018-02-23T09:51:21.951880Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. 2018-02-23T09:51:21.954100Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. Process for mysqld, with ID 952, was started successfully and exited with code 0. MySQL Server 5.7.21 intialized the database successfully. Ended configuration step: Initializing Database [if necessary] Beginning configuration step: Starting Server Attempting to start service MySQL

PHP在Docker中找不到MySQL服务器

<div class="post-text" itemprop="text"> <p>So I have a set of Docker services (running on Ubuntu) that are almost working at the moment:</p> <ul> <li>php/apache webserver</li> <li>MySQL server</li> <li>PHPMyAdmin webserver</li> </ul> <p>I have them set up in the docker-compose defined below, and the PHPMyAdmin is able to interface with the SQL server, but using the PHP connection script below, and calling <code>db_connect()</code>, gives the following error page: </p> <pre><code>Warning: mysqli::__construct():(HY000/2002): No such file or directory in /var/www/html/api/sql_db.php on line 12 MySQLi Connection failed: No such file or directory SESSION: Array ( [sql_server] =&gt; db [username] =&gt; root[password] =&gt; test [dbname] =&gt; bravo </code></pre> <p>File containing <code>db_connect()</code>:</p> <pre><code>&lt;?php session_start(); $servername = "db"; $username = "root"; $password = "test"; $dbname = "bravo"; $_SESSION['sql_server'] = $servername; $_SESSION['username'] = $username; $_SESSION['password'] = $password; $_SESSION['dbname'] = $dbname; function db_connect(){ $conn = new mysqli($servername, $username, $password, $dbname); if ($conn-&gt;connect_errno) { printf("MySQLi Connection failed: %s ", $conn-&gt;connect_error."&lt;br&gt;SESSION: "); print_r($_SESSION); session_destroy(); unset($_SESSION); exit(); } } </code></pre> <p><code>docker-compose.yml</code>: </p> <pre><code>version: '3' services: db: image: mysql:5.7.23 container_name: db command: --default-authentication-plugin=mysql_native_password ports: - 3306:3306 environment: MYSQL_DATABASE: bravo MYSQL_USER: user MYSQL_PASSWORD: test MYSQL_ROOT_PASSWORD: test restart: always volumes: - ./dump:/docker-entrypoint-initdb.d - ./db/data/mysql:/var/lib/mysql networks: - default phpmyadmin: image: phpmyadmin/phpmyadmin links: - db ports: - 8000:80 environment: MYSQL_USER: user MYSQL_PASSWORD: test MYSQL_ROOT_PASSWORD: test depends_on: - db websrv: build: . ports: - 8080:80 volumes: - ./www:/var/www/html links: - db networks: - default depends_on: - db </code></pre> <p>and finally, the <code>Dockerfile</code> referenced by the <code>docker-compose</code> for the <code>websrv</code> service:</p> <pre><code>FROM php:7.1.2-apache RUN docker-php-ext-install mysqli </code></pre> <p>I've gone through a number of forum posts on why mysqli wouldn't connect, but I haven't found an answer that solves my problem yet. </p> <p>I've tried getting the internal ip of the docker container as well, but I haven't had any luck.</p> <p>My choice of the docker images was a result of me trying to simply get php &amp; mysqli, phpMyAdmin, and MySQL all working together. Any functioning combination of the three would be great for me, but surprisingly I haven't really found any public repo that's done it yet.</p> <p>Thanks for any pointers.</p> </div>

打不开ubuntu服务器端的mysql,在线求解答!

查询状态的时候打印如下 xxx@r10f17332:~$ service mysql status mysql stop/waiting 启动的时候打印如下 xxx@r10f17332:~$ service mysql start start: Rejected send message, 1 matched rules; type="method_call", sender=":1.114" (uid=121493 pid=29149 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") 重启的时候打印如下 xxx@r10f17332:~$ service mysql restart stop: Unknown instance: start: Rejected send message, 1 matched rules; type="method_call", sender=":1.116" (uid=121493 pid=29209 comm="start mysql ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init") 查询进程的时候如下 xxx@r10f17332:~$ ps -ef | grep mysql 121493 29298 28933 0 10:16 pts/2 00:00:00 grep --color=auto mysql 并且找不到my.cnf文件 ps:我的用户具有超级管理员权限,但我不是root用户。 求大神支招!!!

Mysql:访问information_schema会崩溃mysql服务

<div class="post-text" itemprop="text"> <p>i have Windows 7 64bit with Mysql 5.5.28 installed and when i try to access information_schema tables via php mysql query the entire mysql.exe service crashes and i have to restart it.</p> <p>I tried to access the information_schema via Phpmyadmin, to make sure I'm not doing something wrong in my query but it crashes as well.</p> <p>I tried to run repair command on the information_schema db, but it did not helped.</p> <p>I have no idea what could be wrong with it. I did not changed any values there, i only access information_schema to read auto_increment values for my tables, but thats it.</p> <p>Any advice appreciated, thanks.</p> </div>

mysql可以正常启动操作,但是/etc/init.d/目录下没有mysqld启动文件,想修改默认数据目录,该怎么做?

# ## 我的mysql一切正常,现在想修改默认数据存放位置,但是发现/etc/init.d/目录下没有mysqld启动文件,这是什么原因? ![图片说明](https://img-ask.csdn.net/upload/201906/26/1561529115_366951.png)

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

再不跳槽,应届毕业生拿的都比我多了!

跳槽几乎是每个人职业生涯的一部分,很多HR说“三年两跳”已经是一个跳槽频繁与否的阈值了,可为什么市面上有很多程序员不到一年就跳槽呢?他们不担心影响履历吗? PayScale之前发布的**《员工最短任期公司排行榜》中,两家码农大厂Amazon和Google**,以1年和1.1年的员工任期中位数分列第二、第四名。 PayScale:员工最短任期公司排行榜 意外的是,任期中位数极小的这两家公司,薪资...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

数据库——玩转SQL语句(以MySQL为例)

一、前言 照着大学的SQL server来学

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

讲一个程序员如何副业月赚三万的真实故事

loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...

上班一个月,后悔当初着急入职的选择了

最近有个老铁,告诉我说,上班一个月,后悔当初着急入职现在公司了。他之前在美图做手机研发,今年美图那边今年也有一波组织优化调整,他是其中一个,在协商离职后,当时捉急找工作上班,因为有房贷供着,不能没有收入来源。所以匆忙选了一家公司,实际上是一个大型外包公司,主要派遣给其他手机厂商做外包项目。**当时承诺待遇还不错,所以就立马入职去上班了。但是后面入职后,发现薪酬待遇这块并不是HR所说那样,那个HR自...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

程序员写出这样的代码,能不挨骂吗?

当你换槽填坑时,面对一个新的环境。能够快速熟练,上手实现业务需求是关键。但是,哪些因素会影响你快速上手呢?是原有代码写的不够好?还是注释写的不够好?昨夜...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

程序员毕业去大公司好还是小公司好?

虽然大公司并不是人人都能进,但我仍建议还未毕业的同学,尽力地通过校招向大公司挤,但凡挤进去,你这一生会容易很多。 大公司哪里好?没能进大公司怎么办?答案都在这里了,记得帮我点赞哦。 目录: 技术氛围 内部晋升与跳槽 啥也没学会,公司倒闭了? 不同的人脉圈,注定会有不同的结果 没能去大厂怎么办? 一、技术氛围 纵观整个程序员技术领域,哪个在行业有所名气的大牛,不是在大厂? 而且众所...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

无代码时代来临,程序员如何保住饭碗?

编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

01、Java入门(Getting Started);02、集成开发环境(IDE);03、项目结构(Eclipse JavaProject);04、类和对象(Classes and Objects);05:词法结构(Lexical Structure);06:数据类型和变量(Data Type and Variables);07:运算符(Operators);08:控制流程语句(Control Flow Statements);

Java岗开发3年,公司临时抽查算法,离职后这几题我记一辈子

前几天我们公司做了一件蠢事,非常非常愚蠢的事情。我原以为从学校出来之后,除了找工作有测试外,不会有任何与考试有关的事儿。 但是,天有不测风云,公司技术总监、人事总监两位大佬突然降临到我们事业线,叫上我老大,给我们组织了一场别开生面的“考试”。 那是一个风和日丽的下午,我翘着二郎腿,左手端着一杯卡布奇诺,右手抓着我的罗技鼠标,滚动着轮轴,穿梭在头条热点之间。 “淡黄的长裙~蓬松的头发...

大牛都会用的IDEA调试技巧!!!

导读 前天面试了一个985高校的实习生,问了他平时用什么开发工具,他想也没想的说IDEA,于是我抛砖引玉的问了一下IDEA的调试用过吧,你说说怎么设置断点...

立即提问
相关内容推荐