アプリ版:「スタンプのみでお礼する」機能のリリースについて

参考書に従って入力したつもりでしたが、最後はエラーがでました。
 以下コマンドプロンプトでの入力の経緯です。

Microsoft Windows [Version 10.0.19043.1165]
(c) Microsoft Corporation. All rights reserved.

C:\MAMP\bin\mysql>$ mysql -u sample_user -p
'$' は、内部コマンドまたは外部コマンド、
操作可能なプログラムまたはバッチ ファイルとして認識されていません。

C:\MAMP\bin\mysql>cd c:\

c:\>mysql -u sample_user -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.6.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

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> use sample_db;
ERROR 1044 (42000): Access denied for user 'sample_user'@'localhost' to database 'sample_db'
mysql> user sample_db;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user sample_db' at line 1
mysql> use sample_db;
ERROR 1044 (42000): Access denied for user 'sample_user'@'localhost' to database 'sample_db'
mysql>
 以上ですが 最後はエラーがでました。直訳したところ
エラー 1044 (42000): ユーザー 'sample_user'@'localhost' のデータベース 'sample_db' へのアクセスが拒否されました
 以上ですが たいしたエラーではないような気がします。
 なので \q で一端消して  sample_db; にアクセスする方法でもいいのでしょうか?
よろしくお願いいたします。

A 回答 (1件)

未経験者ですけれど。



'$' ってLinuxだったかのコマンドプロンプトで表示されてるものではなかったですかね?

参考書をもう一度確認してみては?
・本当にWindows向けの物
・Winのコマンドプロンプトではなく別の物を起動させるようになっている
⇒例えば MSYS などなら左端に ~> ではなく $ が出ます。
    • good
    • 0
この回答へのお礼

ありがとうございます。
エラーの根拠が分かりませんでしたので
以下だ解決したと思われます。

mysql> mysql sample_db -u root -proot
-> \q
Bye

c:\>mysql sample_db -u root -proot
Warning: Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.34-log MySQL Community Server (GPL)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

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.

お礼日時:2022/09/28 06:54

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!