2009年11月29日

MySQL5.1.41 以及管理者創建

解決無法看到show database中的mysql...

下載MySQL5.1.41版本
http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41-win32.msi/from/pick#mirrors

安裝過程中,在MySQL Server Instance Config Wizard選項中,先選擇standard安裝,
並且記得選擇自動加入環境變數到電腦中,以及最後會要你輸入第一次的新密碼。

把C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/
之中的檔案全部複製到E:\DB\serv\Mysql\data



my.ini中修改datadir路徑:
刪掉
C:/Documents and Settings/All Users/Application Data/MySQL/MySQL Server 5.1/Data/
改為(注意斜線方向)

#Path to the database root
datadir="E:/DB/serv/Mysql/data"

CMD中進入MySQL的root帳戶:(其實在E:\DB\serv\Mysql\data目錄底下新增一個普通檔案資料夾,在下列範例中,我們新增了一個test2資料夾,就是增加一個test2的database)


C:\Documents and Settings\Jim>mysql -u root --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql>



mysql> GRANT ALL PRIVILEGES ON *.* TO jimsql@220.132.116.19 IDENTIFIED BY '密碼';
Query OK, 0 rows affected (0.00 sec)



mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql> use mysql;
Database changed
mysql> show tables
    -> ;
+---------------------------+
| Tables_in_mysql           |
+---------------------------+
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
+---------------------------+
23 rows in set (0.01 sec)

mysql> use user;
ERROR 1049 (42000): Unknown database 'user'
mysql> SELECT  user, host, password FROM user;
+--------+----------------+-------------------------------------------+
| user   | host           | password                                  |
+--------+----------------+-------------------------------------------+
| root   | localhost      | * |
| jimsql | 220.132.116.19 | * |
+--------+----------------+-------------------------------------------+
2 rows in set (0.00 sec)

mysql>







C:\Documents and Settings\Jim>mysql --user=jimsql --password=密碼
ERROR 1045 (28000): Access denied for user 'jimsql'@'localhost' (using password:
 YES)

C:\Documents and Settings\Jim>mysql --user=jimsql@localhost --password=密碼
ERROR 1045 (28000): Access denied for user 'jimsql@localhost'@'localhost' (using
 password: YES)

C:\Documents and Settings\Jim>mysql --user=root --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> GRANT ALL PRIVILEGES ON *.* TO jimsql@localhost IDENTIFIED BY '密碼';
Query OK, 0 rows affected (0.00 sec)

mysql> use mysql;
Database changed
mysql> SELECT  user, host, password FROM user;
+--------+----------------+-------------------------------------------+
| user   | host           | password                                  |
+--------+----------------+-------------------------------------------+
| root   | localhost      | * |
| jimsql | 220.132.116.19 | *1 |
| jimsql | localhost      | * |
+--------+----------------+-------------------------------------------+
3 rows in set (0.00 sec)

mysql> exit
Bye

C:\Documents and Settings\Jim>mysql --user=jimsql --password=密碼
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 7
Server version: 5.1.41-community MySQL Community Server (GPL)

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
| test2              |
+--------------------+
4 rows in set (0.00 sec)

mysql>

未完 待續

請打開此網頁


沒有留言:

張貼留言

新電腦上重新安裝 Windows 10

想要在電腦上安裝 Windows 10 嗎? 若要開始使用,您首先必須取得安裝 Windows 10 的授權。然後才可以下載並執行媒體建立工具。如需工具使用方式的詳細資訊,請參閱下列指示。 https://www.microsoft.com/zh-tw/software-...