Markdown

[mysql] 建立新的資料表

MySQL

MYSQL SETTING

[root@localhost conf.d]# sudo service mysqld start
Redirecting to /bin/systemctl start  mysqld.service
[root@localhost conf.d]# sudo grep 'temporary password' /var/log/mysqld.log
2017-05-03T05:55:14.109793Z 1 [Note] A temporary password is generated for root@localhost: TaiOnb;3!B3k
[root@localhost conf.d]# 
[root@localhost conf.d]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 21
Server version: 5.7.18

Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu168';
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Eric_tu168';
Query OK, 0 rows affected (0.01 sec)

mysql> SHOW databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.05 sec)

mysql> 

If something goes wrong during installation, you might find debug information in the error log file /var/log/mysqld.log.
mysql> CREATE DATABASE msgbaord;
Query OK, 1 row affected (0.00 sec)

mysql> USE msgboard
ERROR 1049 (42000): Unknown database 'msgboard'

mysql> DROP DATABASE msgbaord;
Query OK, 0 rows affected (0.06 sec)

mysql> CREATE DATABASE msgboard;
Query OK, 1 row affected (0.01 sec)

mysql> USE msgboard;
Database changed


mysql> CREATE TABLE msglist ( user VARCHAR(25) NOT NULL , text VARCHAR(128) NOT NULL ) ENGINE = InnoDB;
Query OK, 0 rows affected (0.08 sec)
2017/05/04 04:01:55 [error] 58831#0: 

留言