SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2002
    Location
    Odenton, Maryland
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MySQL new user question

    Already established a connection to MySQL from PHP page thanks to Kevin Yank.

    However, now wish to use "Thatware" on web server as a learning exercise.

    PC in question is running RHL 7.3, Apache, MySQL 3.23.51 and PHP 4.1.2.

    It seems logical to me that I need to establish a non root account in MySQL and grant privileges. Perhaps I have this wrong but is it smart to continue using a connection that calls localhost/root/password from any PHP page on the web server?

    What is the correct sequence of commands at the "msql" prompt to create a new database for this use. Also, what commands are needed to create a new user account if required.

    Lastly if the grey matter is still on tap, is "Thatware" a suitable candidate for my setup.

  2. #2
    SitePoint Zealot
    Join Date
    Jul 2002
    Location
    Fort Lauderdale
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To create a new user from the mysql prompt:
    show databases;
    use mysql;
    show tables;
    select * from user;
    There should be a user table. INSERT a new user with the priviliges you want.

    To create a new database:
    create database dbname;
    use dbname;
    create table tablename (
    field1 varchar(16) not null primary key,
    field2 ...
    );

    If you want this db to have the same structure as the user db, then use desc tablename to get a description of the table.

    www.mysql.org has pretty good documentation.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •