「Windows11」scoopを使用してMySQLをインストールする
環境
OS Windows 11 Pro 21H2 64bit
操作方法
1.「スタート」をクリックします。
2.「検索するには,ここに入力します」に「cmd」と入力します。
3.「コマンドプロンプト」->「管理者として実行」をクリックします。
ユーザーアカウント制御画面が表示されます。
「はい」を押下します。
4.mysqlインストール可能バージョンを確認します
C:\Windows\system32>scoop search mysql Results from local buckets... Name Version Source Binaries ---- ------- ------ -------- mariadb 10.8.3 main mysql.exe | mysqladmin.exe | mysqlbinlog.exe | mysqlcheck.exe | mysqld.exe | mysqldum... mysql-workbench 8.0.30 main mysql 8.0.30 main
5.mysqlをインストールします
C:\Windows\system32>scoop install mysql Updating Scoop... Updating 'main' bucket... Converting 'main' bucket to git repo... Checking repo... OK The main bucket was added successfully. Scoop was updated successfully! Installing 'mysql' (8.0.30) [64bit] from main bucket mysql-8.0.30-winx64.zip (215.9 MB) [==========================================================================] 100% Checking hash of mysql-8.0.30-winx64.zip ... ok. Extracting mysql-8.0.30-winx64.zip ... done. Running pre_install script... Linking ~\scoop\apps\mysql\current => ~\scoop\apps\mysql\8.0.30 Creating shim for 'ibd2sdi'. Creating shim for 'innochecksum'. Creating shim for 'lz4_decompress'. Creating shim for 'myisamchk'. Creating shim for 'myisamlog'. Creating shim for 'myisampack'. Creating shim for 'myisam_ftdump'. Creating shim for 'mysql'. Creating shim for 'mysqladmin'. Creating shim for 'mysqlbinlog'. Creating shim for 'mysqlcheck'. Creating shim for 'mysqld'. Creating shim for 'mysqldump'. Creating shim for 'mysqlimport'. Creating shim for 'mysqlpump'. Creating shim for 'mysqlshow'. Creating shim for 'mysqlslap'. Creating shim for 'mysql_config_editor'. Creating shim for 'mysql_secure_installation'. Creating shim for 'mysql_ssl_rsa_setup'. Creating shim for 'mysql_tzinfo_to_sql'. Creating shim for 'mysql_upgrade'. Creating shim for 'my_print_defaults'. Creating shim for 'perror'. Creating shim for 'zlib_decompress'. Persisting data Persisting my.ini Running post_install script... WARN Initializing data directory ... True WARN Database has been initialized (username: root, password: <blank>) 'mysql' (8.0.30) was installed successfully! Notes ----- Run 'mysqld --standalone' or 'mysqld --console' to start the Database, or run following command as administrator to register MySQL as a service. See: https://dev.mysql.com/doc/refman/en/windows-start-service.html mysqld --install MySQL --defaults-file="C:\Users\user\scoop\apps\mysql\current\my.ini" To stop and/or delete the Service run 'sc stop MySQL' and 'sc delete MySQL'. 'mysql' suggests installing 'extras/vcredist2022'.
6.MySQLを起動します。
C:\Windows\system32>mysqld --console 2022-08-13T11:47:18.963927Z 0 [System] [MY-010116] [Server] C:\Users\user\scoop\apps\mysql\current\bin\mysqld.exe (mysqld 8.0.30) starting as process 10552 2022-08-13T11:47:19.275948Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2022-08-13T11:47:27.881347Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2022-08-13T11:47:30.413518Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2022-08-13T11:47:30.413808Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel. 2022-08-13T11:47:30.530980Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060 2022-08-13T11:47:30.531420Z 0 [System] [MY-010931] [Server] C:\Users\user\scoop\apps\mysql\current\bin\mysqld.exe: ready for connections. Version: '8.0.30' socket: '' port: 3306 MySQL Community Server - GPL.
[Windows セキュリティの重要な警告]画面が表示されます。
「アクセスを許可する(A)」を押下します。
7.コマンドプロンプトを起動します
MySQLに接続します。
C:\Users\user>mysql -uroot -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 8 Server version: 8.0.30 MySQL Community Server - GPL Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select version(); +-----------+ | version() | +-----------+ | 8.0.30 | +-----------+ 1 row in set (0.00 sec)