Thursday, October 16, 2014

Create Mysql database and user for PHP applications

Thursday, October 16, 2014 Posted by Andre Broers 47 comments
I always struggle with the syntax to create a new mysql database and user for a php installation.

Hereby a quick reminder.


azureuser@myhost:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 157
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, 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 prestashop;
Query OK, 1 row affected (0.00 sec)

mysql> create user 'prestashopuser'@'localhost' identified by 'xxxxxxxxx';
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on prestashop.* to 'prestashopuser'@'localhost';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
azureuser@myhost:~$ mysql -u prestashopuser -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 158
Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

Copyright (c) 2000, 2014, 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 |
| prestashop         |
+--------------------+
2 rows in set (0.00 sec)

mysql>




47 comments:

  1. I get a lot of great information from this blog. Thank you for your sharing this informative blog. Recently I did PHP course at a leading academy. If you are looking for best PHP Training Institute in Chennai visit FITA IT training academy which offer real timePHP Course in Chennai.

    ReplyDelete
  2. Hi, Thanks for sharing this valuable blog.I was really impressed by reading this blog. I did HTML Training in Chennai at reputed HTML5 Training Institutes in Chennai. This is really useful for me to make a bright future in designing field.

    ReplyDelete
  3. These all are notable facts… I stick with responsive website design for my business. With the mobile marketing is at its peak stage, having website that goes comfy on all devices will help your business. You can check my website for more details on the importance of responsive website design. PHP Training in Chennai | Best PHP training in Chennai | PHP Training Institute in Chennai

    ReplyDelete
  4. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. Web design training in chennai

    ReplyDelete
  5. Hi friends, This is Murali from Chennai. I am a technology freak. Your technical information is really useful for me. Keep update your blog.
    Regards..
    Oracle Course in Chennai

    ReplyDelete
  6. Great piece of information, thanks for sharing this amazing post on php.

    ReplyDelete
  7. s there a way to create a new MySQL database, a new MySQL user and give the new user privileges on the new database all using PHP?

    EDIT - should be pointed out this is run from 1 server to another, so Server A trying to install a DB/user on Server B.

    For Details : PHP Training in Chennai

    ReplyDelete
  8. To make and erase a database you ought to have administrator priviledge. Its simple to make another MySQL database. PHP utilizes mysql_query capacity to make a MySQL database. This capacity takes two parameters and profits TRUE for achievement or FALSE on disappointment.

    Syntax :
    bool mysql_query( sql, connection );

    For More info : My SQL Training in Chennai

    ReplyDelete
  9. My SQL using the php for extract the data base to learn the advanced DB training oracle product weblogic server SQL
    learn more oracle

    ReplyDelete
  10. There are lots of information about latest technology, like Hadoop cluster is a special type of computational cluster designed specifically for storing and analyzing huge amounts of unstructured data in a distributed computing environment. This information seems to be more unique and interesting. Thanks for sharing.
    Hadoop Training Chennai | Best Hadoop Training in Chennai | Big Data Training

    ReplyDelete
  11. Your blog is really awesome and I get a lot of great information from this blog. Thanks for sharing such an informative post on blog. Keep posting. It’s really useful and interesting...
    Healthcare Business Analysis Online Training
    Tableau Online Training
    Qlikview Online Training
    ServiceNow Administrator Online Training
    Peoplesoft HRMS Functional Online Training

    ReplyDelete
  12. I'am planning to join Oracle certified course. I want some expert advice whether i should go for it or not.
    oracle training in chennai|oracle training institutes in chennai|FITA Chennai complaints

    ReplyDelete
  13. The best thing about HTML5 is that it allows the developers to embed the video files, audio files, and high quality graphics without any third party applications.
    html5 training in chennai | html5 training institutes in chennai | Fita Chennai reviews

    ReplyDelete
  14. Nice article you might have carried out below. My business is truly happy to see that. This is the incredibly helpful matter. keep that you're selected it up.Support Page

    ReplyDelete
  15. PHP is the best language to develop data driven websites. PHP is used by majority of the ecommerce websites. Learning PHP can give you a great future for sure.
    PHP training in Chennai | PHP course in Chennai | PHP training institute in Chennai

    ReplyDelete
  16. Dot net is a Microsoft product so it is the best language to develop applications for windows and it is supported well on the windows platform. Dot net is prefferd globally and a renowned platform with lots of job opportunities.
    Dot net training in Chennai | .NET training in Chennai | Dot net course in Chennai

    ReplyDelete

  17. I have completely read your post and the content is crisp and clear.Thank you for posting such an informative article, I have decided to follow your blog so that I can myself updated.
    Android training in Chennai | Android course in Chennai | Android training institute in Chennai

    ReplyDelete
  18. Hadoop is one of the best tool which is used to handle the big data in the IT industy and it is the fastest growing field in information technology.
    hadoop training in Chennai | hadoop training chennai

    ReplyDelete
  19. Excellent post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    salesforce training in chennai | salesforce training institute in chennai

    ReplyDelete
  20. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Node JS training in chennai | Node JS training institute in chennai

    ReplyDelete
  21. Hope you can help us to Learn and build MVC Applications using Codeigniter

    PHP Course

    ReplyDelete
  22. Well Said, you have furnished the right information that will be useful to anyone at all time. Thanks for sharing your Ideas.
    Hadoop Training in Chennai | Hadoop Training Chennai

    ReplyDelete
  23. Excellent content. Thanks for sharing content which is very useful that provided me the required information.
    Cloud Computing Training in Chennai | Cloud Computing Courses in Chennai

    ReplyDelete
  24. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision, keep sharing.
    Regards,

    PHP Training in Chennai | Webdesigning Training in Chennai

    ReplyDelete
  25. This is my first visit to your blog, your post made productive reading, thank you. dot net training in chennai

    ReplyDelete
  26. It's interesting that many of the bloggers your tips helped to clarify a few things for me as well as giving.. very specific nice content. And tell people specific ways to live their lives.Sometimes you just have to yell at people and give them a good shake to get your point across.

    SEO Company in India

    ReplyDelete
  27. Great article, Thanks for your valuable information. it is very useful to learn and understand for me.
    PHP Training institute in chennai | PHP Training in velachery

    ReplyDelete
  28. Pretty article! I found some useful information in your blog. Android Training in Chennai

    ReplyDelete
  29. Thank you for the writing a good article and it helps me a lot. Buy crackers online at wholesale price and purchase original fire crackers / online crackers

    ReplyDelete