程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> MySQL備忘錄

MySQL備忘錄

編輯:MySQL綜合教程

MySQL備忘錄


在 openSUSE 12.1 操作系統中安裝並配置 MySQL 數據庫服務器:

$ sudo zypper install mysql-community-server
$ sudo vim /etc/my.cnf
[mysqld]
sql-mode="TRADITIONAL"
$ sudo /sbin/chkconfig --add mysql
$ sudo /etc/init.d/mysql start
$ sudo /usr/bin/mysql_secure_installation
$ mysql -u root -p****
mysql> CREATE DATABASE test charset ucs2;
mysql> GRANT ALL PRIVILEGES ON test.* TO test@"%" IDENTIFIED BY "pwd-for-test";
mysql> exit

在 Windows Vista 操作系統使用 MySQL 客戶端:

D:\Bin\MySQL\Workbench> mysql -h test.skyiv.com -u test -ppwd-for-test test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.16-log Source distribution

Copyright (c) 2000, 2011, 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(),user(),now(),database();
+------------+--------------------+---------------------+------------+
| version()  | user()             | now()               | database() |
+------------+--------------------+---------------------+------------+
| 5.5.16-log | [email protected] | 2012-02-24 19:37:24 | test       |
+------------+--------------------+---------------------+------------+
1 row in set (0.00 sec)

mysql> select @@sql_mode;
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| @@sql_mode                                                                                                                                           |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
| STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,TRADITIONAL,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
+------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)

mysql> exit
Bye

D:\Bin\MySQL\Workbench>

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved