

参考書に従って入力したつもりでしたが、最後はエラーがでました。
以下コマンドプロンプトでの入力の経緯です。
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で質問しましょう!
関連するカテゴリからQ&Aを探す
おすすめ情報
デイリーランキングこのカテゴリの人気デイリーQ&Aランキング
-
下記の問合せを行うクエリを、P...
-
mysqlがインストールされている...
-
テーブル名が可変の場合のクエ...
-
#1062 - '0' は索引 'PRIMARY' ...
-
テーブル作成時のカラムについて
-
SQL文についての質問です。
-
「ストレージエンジン」とは何か
-
データベースの接続に失敗して...
-
同一日に複数レコードがある場...
-
MAMP 99ドル約1.6万円 高い...
-
あってますか?SQL
-
WHERE `年月日` = '晴' OR `年...
-
SQLです教えてくださいお願いし...
-
SQLを作ったのですがうまくいき...
-
(初心者)MySQLやmaraDBで、crea...
-
SQLです教えてくださいお願いし...
-
SQLです教えてくださいお願いし...
-
SQLです教えてください。
-
SQLです教えてくださいお願いし...
-
SQLです教えてくださいお願いし...
マンスリーランキングこのカテゴリの人気マンスリーQ&Aランキング
-
Mysqlでmysql -u root -p -bが...
-
mysqlで自動ログインを行ないた...
-
create database
-
参考書に従って入力したつもり...
-
全権限をもつユーザの追加方法
-
mysqlがインストールされている...
-
MySQLカラム名は日本語と英数字...
-
ODP.NETのバージョン確認
-
副問合せにLIKE文を使う方法は...
-
SQLのVARCHARとVARCHAR2の違い
-
エクセルで連勤チェックをした...
-
ERROR 1045 (28000) (using pas...
-
旧filemakerで和暦(令和など)...
-
列数が多いと結果が行単位に改...
-
Usage: \\.<filename> | sourc...
-
VBAで変数内に保持された二次配...
-
INT型は金額の型に使用するべき...
-
like句を使って日本語を検索す...
-
mysqlへのインポート処理がうま...
-
テーブル作成でエラーが出てき...
おすすめ情報