![](http://oshiete.xgoo.jp/images/v2/pc/qa/question_title.png?e8efa67)
![](http://oshiete.xgoo.jp/images/v2/common/profile/M/noimageicon_setting_01.png?e8efa67)
参考書に従って入力したつもりでしたが、最後はエラーがでました。
以下コマンドプロンプトでの入力の経緯です。
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; にアクセスする方法でもいいのでしょうか?
よろしくお願いいたします。
No.1ベストアンサー
- 回答日時:
未経験者ですけれど。
'$' ってLinuxだったかのコマンドプロンプトで表示されてるものではなかったですかね?
参考書をもう一度確認してみては?
・本当にWindows向けの物
・Winのコマンドプロンプトではなく別の物を起動させるようになっている
⇒例えば MSYS などなら左端に ~> ではなく $ が出ます。
ありがとうございます。
エラーの根拠が分かりませんでしたので
以下だ解決したと思われます。
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.
お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!
似たような質問が見つかりました
- MySQL MySQLのテーブル作成でハイフン - は使用できないのでしょうか? 2 2022/10/21 16:50
- MySQL 何にかが違うから エラーなんでしょうね! 2 2022/09/18 05:28
- MySQL テーブル作成です。どこかのスペルが間違っているか記号など スペースかな? 1 2022/10/01 05:08
- MySQL データベースの複製の仕方(mysql) 2 2023/05/30 18:24
- 英語 L-PRF can be obtained by manual or automated metho 1 2022/04/08 09:39
- 戦争・テロ・デモ ウクライナ、メル友に五千円要求されてさ 1 2022/04/02 09:38
- その他(SNS・コミュニケーションサービス) 自分のpcがハッキングされたようなメールが来たのですがどうすればいいですか? 4 2022/10/02 16:14
- 英語 英文の添削お願いします。【長文です。】 マッチングアプリで相手を言い負かしている時のやつです。 色々 1 2023/07/01 02:12
- その他(プログラミング・Web制作) laravel 本番環境でメールが送れません。 1 2023/02/17 17:57
- YouTube youtubeからの著作権メールについて 2 2023/02/14 16:12
関連するカテゴリからQ&Aを探す
おすすめ情報
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
参考書に従って入力したつもり...
-
ロードバランサからmysqlの生存...
-
接続ができません
-
SQLのVARCHARとVARCHAR2の違い
-
副問合せにLIKE文を使う方法は...
-
VBAで変数内に保持された二次配...
-
ERROR 1045 (28000) (using pas...
-
DB内の日本語データがPHPで取得...
-
mysqlコマンドでSQL文が実行で...
-
RPMのmysqlとmysql-serverの違い
-
パスワード入力を省略したい
-
【MySQL+php】 MySQL が認識さ...
-
MAX()でENUMの内部番号が最大の...
-
MySQL エラー Duplicate entry...
-
データベースの選択エラー
-
MySQL のログ出力方法について ...
-
mysqlがインストールされている...
-
2023年10月25日現在のMAMP ...
-
ODP.NETのバージョン確認
-
mysqlの文字化けがどうしても治...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
参考書に従って入力したつもり...
-
Oracleで言う所のset head offなど
-
コマンドプロンプトに表示させ...
-
Mysqlでmysql -u root -p -bが...
-
MySQL の安全な再起動とコネク...
-
LinuxのMySQLのrootパスワード...
-
mysqlのログについて
-
drop userコマンドを使って、My...
-
MySQは大文字小文字は関係ない ...
-
ロードバランサからmysqlの生存...
-
LinuxユーザーとMySQLユーザの関係
-
ユーザの権限及びユーザの削除...
-
MySQLにおいてバッチ処理...
-
select * outfileがうまくいき...
-
mysqlで自動ログインを行ないた...
-
接続ができません
-
SQLのVARCHARとVARCHAR2の違い
-
副問合せにLIKE文を使う方法は...
-
ODP.NETのバージョン確認
-
MySQLカラム名は日本語と英数字...
おすすめ情報