質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Q&A

解決済

1回答

7780閲覧

mysqlがwindowsサービスで再起動すると立ち上がらなくなる

退会済みユーザー

退会済みユーザー

総合スコア0

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

0グッド

1クリップ

投稿2019/11/01 01:12

編集2019/11/01 01:33

使用環境

win7 32bit
myslq 5.7

行った手順

①インストール後、環境変数にbinのパスを追記 ;C:\Program Files\MySQL\MySQL Server 5.7\bin
②cmdでmysqlにmysql -u root -p でログイン確認
③timezone_posixをcmdに貼り付けタイムゾーン設定
⑤my.iniのSERVER SECTIONにdefault-time-zone = 'Japan'を追記
④windowsサービスでmysql57を一度停止して、再度開始すると、状態 "開始中"になりmysqlへ接続出来なくなる

⑤でのエラーコード

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

mysqlのログのwarning部分

2019-10-31T07:45:32.409326Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key 2019-10-31T08:14:27.103784Z 0 [Warning] C:\Program Files\MySQL\MySQL Server 5.7\bin\mysqld.exe: Forcing close of thread 8 user: 'root'

my.ini

# Other default tuning values # MySQL Server Instance Configuration File # ---------------------------------------------------------------------- # Generated by the MySQL Server Instance Configuration Wizard # # # Installation Instructions # ---------------------------------------------------------------------- # # On Linux you can copy this file to /etc/my.cnf to set global options, # mysql-data-dir/my.cnf to set server-specific options # (@localstatedir@ for this installation) or to # ~/.my.cnf to set user-specific options. # # On Windows you should keep this file in the installation directory # of your server (e.g. C:\Program Files\MySQL\MySQL Server X.Y). To # make sure the server reads the config file use the startup option # "--defaults-file". # # To run the server from the command line, execute this in a # command line shell, e.g. # mysqld --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini" # # To install the server as a Windows service manually, execute this in a # command line shell, e.g. # mysqld --install MySQLXY --defaults-file="C:\Program Files\MySQL\MySQL Server X.Y\my.ini" # # And then execute this in a command line shell to start the server, e.g. # net start MySQLXY # # # Guidelines for editing this file # ---------------------------------------------------------------------- # # In this file, you can use all long options that the program supports. # If you want to know the options a program supports, start the program # with the "--help" option. # # More detailed information about the individual options can also be # found in the manual. # # For advice on how to change settings please see # https://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html # # # CLIENT SECTION # ---------------------------------------------------------------------- # # The following options will be read by MySQL client applications. # Note that only client applications shipped by MySQL are guaranteed # to read this section. If you want your own MySQL client program to # honor these values, you need to specify it as an option during the # MySQL client library initialization. # [client] # pipe= # socket=MYSQL port=3306 [mysql] no-beep # default-character-set= # SERVER SECTION # ---------------------------------------------------------------------- # # The following options will be read by the MySQL Server. Make sure that # you have installed the server correctly (see above) so it reads this # file. # # server_type=2 [mysqld] default-time-zone = 'Japan' # The next three options are mutually exclusive to SERVER_PORT below. # skip-networking # enable-named-pipe # shared-memory # shared-memory-base-name=MYSQL # The Pipe the MySQL Server will use # socket=MYSQL # The TCP/IP Port the MySQL Server will listen on port=3306 # Path to installation directory. All paths are usually resolved relative to this. # basedir="C:/Program Files/MySQL/MySQL Server 5.7/" # Path to the database root datadir=C:/ProgramData/MySQL/MySQL Server 5.7/Data # The default character set that will be used when a new schema or table is # created and no character set is defined # character-set-server= # The default storage engine that will be used when create new tables when default-storage-engine=INNODB # Set the SQL mode to strict sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION" # General and Slow logging. log-output=FILE general-log=0 general_log_file="PC-20140.log" slow-query-log=1 slow_query_log_file="PC-20140-slow.log" long_query_time=10 # Error Logging. log-error="PC-20140.err" # ***** Group Replication Related ***** # Specifies the base name to use for binary log files. With binary logging # enabled, the server logs all statements that change data to the binary # log, which is used for backup and replication. # log-bin # ***** Group Replication Related ***** # Sets the binary logging format, and can be any one of STATEMENT, ROW, # or MIXED. ROW is suggested for Group Replication. # binlog_format # ***** Group Replication Related ***** # Causes the master to write a checksum for each event in the binary log. # binlog_checksum supports the values NONE (disabled) and CRC32. # The default is CRC32. When disabled (value NONE), the server verifies # that it is writing only complete events to the binary log by writing # and checking the event length (rather than a checksum) for each event. # NONE must be used with Group Replication. # binlog_checksum # ***** Group Replication Related ***** # The base name for the relay log. The server creates relay log files in # sequence by adding a numeric suffix to the base name. If you specify this # option, the value specified is also used as the base name for the relay log # index file. Relay logs increase speed by using load-balancing between disks. relay_log="PC-20140-relay" # ***** Group Replication Related ***** # Specifies the server ID. For servers that are used in a replication topology, # you must specify a unique server ID for each replication server, in the # range from 1 to 2^32 − 1. “Unique” means that each ID must be different # from every other ID in use by any other replication master or slave. server-id=1 # ***** Group Replication Related ***** # The host name or IP address of the slave to be reported to the master # during slave registration. This value appears in the output of SHOW SLAVE HOSTS # on the master server. Leave the value unset if you do not want the slave to # register itself with the master. # report_host=0.0 # ***** Group Replication Related ***** # The TCP/IP port number for connecting to the slave, to be reported to the master during # slave registration. Set this only if the slave is listening on a nondefault port or if # you have a special tunnel from the master or other clients to the slave. report_port=3306 # ***** Group Replication Related ***** # This option specifies whether global transaction identifiers (GTIDs) are # used to identify transactions. ON must be used with Group Replication. # gtid_mode # ***** Group Replication Related ***** # When enabled, the server enforces GTID consistency by allowing execution of # only statements that can be safely logged using a GTID. You must set this # option to ON before enabling GTID based replication. # enforce_gtid_consistency # ***** Group Replication Related ***** # Whether updates received by a slave server from a master server should be # logged to the slave's own binary log. Binary logging must be enabled on # the slave for this variable to have any effect. ON must be used with # Group Replication. # log_slave_updates # ***** Group Replication Related ***** # Determines whether the slave server logs master status and connection information # to an InnoDB table in the mysql database, or to a file in the data directory. # The TABLE setting is required when multiple replication channels are configured. # master_info_repository # ***** Group Replication Related ***** # Determines whether the slave server logs its position in the relay logs to an InnoDB # table in the mysql database, or to a file in the data directory. The TABLE setting is # required when multiple replication channels are configured. # relay_log_info_repository # ***** Group Replication Related ***** # Defines the algorithm used to hash the writes extracted during a transaction. If you # are using Group Replication, this variable must be set to XXHASH64 because the process # of extracting the writes from a transaction is required for conflict detection on all # group members. # transaction_write_set_extraction lower_case_table_names=1 # Secure File Priv. secure-file-priv="C:/ProgramData/MySQL/MySQL Server 5.7/Uploads" # The maximum amount of concurrent sessions the MySQL server will # allow. One of these connections will be reserved for a user with # SUPER privileges to allow the administrator to login even if the # connection limit has been reached. max_connections=151 # The number of open tables for all threads. Increasing this value # increases the number of file descriptors that mysqld requires. # Therefore you have to make sure to set the amount of open files # allowed to at least 4096 in the variable "open-files-limit" in # section [mysqld_safe] table_open_cache=2000 # Maximum size for internal (in-memory) temporary tables. If a table # grows larger than this value, it is automatically converted to disk # based table This limitation is for a single table. There can be many # of them. tmp_table_size=80M

windowsサービスでmysql57を再起動した後接続できなくなります。
mysql自体が立ち上がってないようですので、iniファイルに何か問題がないかと睨めっこしています・・・
是非お力添えをお願いしたいですm(__)m

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

yoorwm

2019/11/01 01:17

> mysql自体が立ち上がってないようですので、iniファイルに何か問題がないかと睨めっこしています・・・ このように書いておきながら、iniファイルが記載されていないのはなぜでしょうか?
退会済みユーザー

退会済みユーザー

2019/11/01 01:28

文字数制限で記入出来ませんでしたm(__)m
LineOfLightning

2019/11/01 01:43

どのような設定でインストールしたか、インストールした後にどのような作業をしたか細かくわからないので質問します。 ・my.iniからdefault-time-zone = 'Japan'を消した場合はサービスから起動できますか? ・コマンドプロンプトから手動では起動できますか?
退会済みユーザー

退会済みユーザー

2019/11/01 01:51

default-time-zone = 'Japan'を消して更新しても開始中のままです。 手動でもできないです・・
LineOfLightning

2019/11/01 01:58

手動でもできないってことは、サービスだからどうこうとは関係ないですね。 考えられることは2つ ・mysqlの起動 or シャットダウンに失敗して、mysqlのプロセスが居残り続けており、リソース(ポート等)が使えないので起動に失敗してしまう ・my.ini等の設定、データ等がおかしくて起動できなくなってしまっている 前者かどうか切り分けるために、タスクマネージャーでmysqlが動いていないか確認してmysql関連全て終了させる or Windowsの再起動をしてみてください。 後者の場合、データ等に未練がなければ、mysqlを再インストールをお勧めします。 ちなみに、timezoneですが、自分でJapanというタイムゾーンをtime_zoneテーブルに追加したんですよね?
退会済みユーザー

退会済みユーザー

2019/11/01 02:16

タスクマネージャではmysql.exeとmysqlNotifier.exeのタスクを切ってみましたが状況は変わりませんでした。 再インストールは2度しましたが、毎度同じタイミングで停止してしまっています。 タイムゾーンのテーブルは作っていないです・・・ timezone_posixの中身をcmdにコピペしました。
LineOfLightning

2019/11/01 02:41

>timezone_posixの中身をcmdにコピペしました。 「mysql -u root -p mysql < C:\****\timezone_posix.sql」のようなコマンドですか? そうであれば、大丈夫です。Japanも作成されているはずです。 mysql.exeはクライアントのプロセスです「mysql -u root」等で接続している奴そのものです。 mysqld.exeというプロセスはありませんでしたか? 再インストールしても駄目な場合、プロセスが残ってる可能性が高いのですが・・・。 Mysqlを再インストール(Mysqlをアンインストール&インストール)し、その後にWindowsを再起動してみてください。
退会済みユーザー

退会済みユーザー

2019/11/01 03:05

timezone_posixmの中身を確認したところ自動でテーブルを作成してくれているみたいでした。 mysqldはなかったと思います。 タスクを切ってから、cmdからremove →プログラムの追加削除から、mysql serverを最初に、残りすべてをアンインストール →programFileとprogramDataのmysqlフォルダを削除 これでプロセスを残さずに再インストールできそうですかね・・・ 今セコセコアンインストールしています
guest

回答1

0

ベストアンサー

ちなみに、MySQLのプロセスが生き残り続けてるかどうかは、
以下のコマンドをコマンドプロンプトで実行することでも確認できます。
※「mysql -u root」等でmysqlのクライアントで接続したままのcmdがある場合は、閉じてから行ってください。

「netstat -n | find ":3306"」

※MySQLのデフォルトのポート番号が3306。変更している場合は数字を変えてください。

このコマンドで何も表示されなければ、そのポートは使用されていないのでMySQLのプロセスはないはずです。

投稿2019/11/01 03:25

LineOfLightning

総合スコア253

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

退会済みユーザー

退会済みユーザー

2019/11/01 07:08

再インストールしましたが、また同じエラーが出ました。 停止して、再度開始したときのエラー文は以下の通りです。 ローカルコンピュータのmysql57サービスを開始できません。 エラー1053: そのサービスは指定時間内に開始要求または制御要求に応答しませんでした。
LineOfLightning

2019/11/01 07:13

エラー1053は以下のサイトにも記載されている通り、タイムアウトが発生した時なので、マシンスペックが足りない等で起動に非常に時間がかかってしまう場合は普通に起きてしまいますので、必ずしもエラーとは言い難いのですが・・・。 ちなみに、「C:\ProgramData\MySQL\MySQL Server X.X\Data」にあるエラーログ(拡張子が.err)のものはどう記載されていますか? https://support.microsoft.com/ja-jp/help/3065893
退会済みユーザー

退会済みユーザー

2019/11/01 07:53

mysqlを一度終了してからの開始なので、ログの最後は正常に終了したことが記載されていました。 今mysqlのバージョンを下げてもう一度インストールし直しています。
LineOfLightning

2019/11/01 07:56

サービスから起動した時にエラーになって起動できないようであれば、エラーログに出力されているはずです。 正常に終了したと記載されているのであれば、サービスの開始で(タイムアウトにはなったけど)正常に起動し、サービスの終了で正常に終了したのではないですか?
退会済みユーザー

退会済みユーザー

2019/11/01 08:52

mysqlを5.7から5.6に下げるとすんなり通りました・・・ 理由は分かりませんが笑
退会済みユーザー

退会済みユーザー

2019/11/01 08:53

ご丁寧に導いて下さってありがとうございました!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問