SQL/MySQL/User Permission/Password

Материал из SQL эксперт
Перейти к: навигация, поиск

Use Password encode

/*
mysql> Drop table UserAccounts;
mysql> CREATE TABLE UserAccounts
    -> (
    ->    UserID SMALLINT NOT NULL PRIMARY KEY,
    ->    Password VARCHAR(20) NOT NULL
    -> );
Query OK, 0 rows affected (0.11 sec)
mysql> INSERT INTO UserAccounts
    -> VALUES (101, ENCODE("pw101", "key101"));
Query OK, 1 row affected (0.03 sec)
mysql> select * from UserAccounts;
+--------+----------+
| UserID | Password |
+--------+----------+
|    101 | ?*&      |
+--------+----------+
1 row in set (0.00 sec)
*/
Drop table UserAccounts;
CREATE TABLE UserAccounts
(
   UserID SMALLINT NOT NULL PRIMARY KEY,
   Password VARCHAR(20) NOT NULL
);

INSERT INTO UserAccounts
VALUES (101, ENCODE("pw101", "key101"));

select * from UserAccounts;