MySQL添加远程登录用户

[root@localhost home]# reboot

Broadcast message from root (pts/1) (Wed Jun 15 18:10:17 2011):

The system is going down for reboot NOW!
[root@localhost home]# Last login: Wed Jun 15 17:22:10 2011
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd ../home
[root@localhost home]# netstat -antp
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:2208 0.0.0.0:* LISTEN 3652/hpiod
tcp 0 0 0.0.0.0:650 0.0.0.0:* LISTEN 3436/rpc.statd
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 3404/portmap
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2956/cupsd
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 3806/sendmail: acce
tcp 0 0 127.0.0.1:2207 0.0.0.0:* LISTEN 3657/python
tcp 0 0 :::3306 :::* LISTEN 3761/mysqld
tcp 0 0 :::22 :::* LISTEN 3670/sshd
tcp 0 144 ::ffff:192.168.184.136:22 ::ffff:192.168.184.1:1526 ESTABLISHED 4152/1
[root@localhost home]# mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@localhost home]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 2
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, 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> select version();
+-----------+
| version() |
+-----------+
| 5.6.2-m5 |
+-----------+
1 row in set (0.01 sec)

mysql> show engines;
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
| BLACKHOLE | YES | /dev/null storage engine (anything you write to it disappears) | NO | NO | NO |
| PERFORMANCE_SCHEMA | YES | Performance Schema | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| ARCHIVE | YES | Archive storage engine | NO | NO | NO |
| MyISAM | YES | MyISAM storage engine | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
+--------------------+---------+----------------------------------------------------------------+--------------+------+------------+
9 rows in set (0.00 sec)
mysql> CREATE USER 'admin'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON *.* TO 'admin'@'%';
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye
[root@localhost home]# mysql -u admin -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 3
Server version: 5.6.2-m5 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, 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> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| test |
+--------------------+
2 rows in set (0.00 sec)

你可能感兴趣的:(mysql)