How to create new mysql database account
Author: Thorpe Lee(email@example.com), Front&Back-end Developer, posted on 2015-12-09 00:18:37
How to create new database
If your server was already installed the mysql-server. you can command below.
root@shell:~$ /usr/local/mysql/bin/mysql -u root -p mysql
Enter password: *************
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.5.27-log MySQL Community Server (GPL) 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> create database newaccount; Query OK, 1 row affected (0.10 sec) mysql> insert into db value ('localhost','dbname','dbuser','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y'); Query OK, 1 row affected (0.00 sec) mysql> insert into user (host,user,password) value ('localhost','dbuser',password('dbpassword')); Query OK, 1 row affected, 3 warnings (0.04 sec) mysql> flush privileges;
* 주의 : insert into db 시 버전별로 컬럼의 갯수가 다르다. mysql 5.5.27에는 위와 같이 하면 생성되지만 다른 버전에서는 에러가 날수있습니다.