Results 1 to 3 of 3

Thread: Running mySQL query

  1. #1
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default Running mySQL query

    I am just working on my first projects (a MediaWiki) that involves mySQL. I am very unfamiliar with mySQL. I need to run the following query on my database.
    Code:
    -- (c) Aaron Schulz, 2007
    
    -- Table structure for table `Confirm account`
    -- Replace /*$wgDBprefix*/ with the proper prefix
    
    -- This stores all of our reviews, 
    -- the corresponding tags are stored in the tag table
    CREATE TABLE /*$wgDBprefix*/account_requests (
      acr_id int unsigned NOT NULL auto_increment,
      -- Usernames must be unique, must not be in the form of
      -- an IP address. _Shouldn't_ allow slashes or case
      -- conflicts. Spaces are allowed, and are _not_ converted
      -- to underscores like titles. See the User::newFromName() for
      -- the specific tests that usernames have to pass.
      acr_name varchar(255) binary NOT NULL default '',
      -- Optional 'real name' to be displayed in credit listings
      acr_real_name varchar(255) binary NOT NULL default '',
      -- Note: email should be restricted, not public info.
      -- Same with passwords.
      acr_email tinytext NOT NULL,
      -- Initially NULL; when a user's e-mail address has been
      -- validated by returning with a mailed token, this is
      -- set to the current timestamp.
      acr_email_authenticated binary(14) default NULL,
      -- Randomly generated token created when the e-mail address
      -- is set and a confirmation test mail sent.
      acr_email_token binary(32),
      -- Expiration date for the user_email_token
      acr_email_token_expires binary(14),
      -- A little about this user
      acr_bio mediumblob NOT NULL,
      -- Private info for reviewers to look at when considering request
      acr_notes mediumblob NOT NULL,
      -- Links to recognize/identify this user, CSV, may not be public
      acr_urls mediumblob NOT NULL,
      -- IP address
      acr_ip VARCHAR(255) NULL default '',
      -- Name of attached file (.pdf,.doc,.txt etc...)
      acr_filename VARCHAR(255) NULL,
      acr_storage_key VARCHAR(64) NULL,
      -- Prospective account access level
      acr_type tinyint(255) unsigned default 0,
      -- Areas of interest
      acr_areas mediumblob NOT NULL,
      
      -- Timestamp of account registration.
      acr_registration char(14) NOT NULL,
      
      -- Flag for rejected accounts
      acr_deleted bool NOT NULL,
      -- Time of rejection (if rejected)
      acr_rejected binary(14),
      -- Time request was put on hold (if held)
      acr_held binary(14),
      -- The user who rejected/held it
      acr_user int unsigned NOT NULL default 0,
      -- Reason
      acr_comment varchar(255) NOT NULL default '',
      
      PRIMARY KEY (acr_id),
      UNIQUE KEY (acr_name),
      UNIQUE KEY (acr_email(255)),
      INDEX (acr_email_token),
      INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration)
    ) TYPE=InnoDB;
    
    -- This stores all of credential information
    -- When accounts are confirmed, the identity info goes here
    CREATE TABLE /*$wgDBprefix*/account_credentials (
      -- Revision ID #
      acd_id int unsigned NOT NULL auto_increment,
      -- Foreign key to user.user_id
      acd_user_id int unsigned NOT NULL,
      -- Optional 'real name' to be displayed in credit listings
      acd_real_name varchar(255) binary NOT NULL default '',
      -- Note: email should be restricted, not public info.
      -- Same with passwords.
      acd_email tinytext NOT NULL,
      -- Initially NULL; when a user's e-mail address has been
      -- validated by returning with a mailed token, this is
      -- set to the current timestamp.
      acd_email_authenticated binary(14) default NULL,
      -- A little about this user
      acd_bio mediumblob NOT NULL,
      -- Private info for reviewers to look at when considering request
      acd_notes mediumblob NOT NULL,
      -- Links to recognize/identify this user, CSV, may not be public
      acd_urls mediumblob NOT NULL,
      -- IP address
      acd_ip VARCHAR(255) NULL default '',
      -- Name of attached file (.pdf,.doc,.txt etc...)
      acd_filename VARCHAR(255) NULL,
      acd_storage_key VARCHAR(64) NULL,
      -- Areas of interest
      acd_areas mediumblob NOT NULL,
      
      -- Timestamp of account registration.
      acd_registration char(14) NOT NULL,
      
      -- Timestamp of acceptance
      acd_accepted binary(14),
      -- The user who accepted it
      acd_user int unsigned NOT NULL default 0,
      -- Reason given in email
      acd_comment varchar(255) NOT NULL default '',
      
      PRIMARY KEY (acd_user_id,acd_id),
      UNIQUE KEY (acd_id)
      
    ) TYPE=InnoDB;
    but have absolutely no clue how to do so. When I click the 'query' tab, I get this:
    Attachment 1953
    I have no clue what any of this means. Could somebody please tell me what to do?
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  2. #2
    Join Date
    Feb 2007
    Location
    🌎
    Posts
    528
    Thanks
    10
    Thanked 10 Times in 10 Posts
    Blog Entries
    2

    Default

    Sorry about the small dimensions.
    Attachment 1954
    ....(o_ Penguins
    .---/(o_- techno_racing
    +(---//\-' in
    .+(_)--(_)' The McMurdo 500

  3. #3
    Join Date
    Mar 2008
    Posts
    122
    Thanks
    17
    Thanked 5 Times in 5 Posts

    Default

    ok, first i have taken all the comments out of the code:

    Code:
    CREATE TABLE /*$wgDBprefix*/account_requests (
      acr_id int unsigned NOT NULL auto_increment,
      acr_name varchar(255) binary NOT NULL default '',
      acr_real_name varchar(255) binary NOT NULL default '',
      acr_email tinytext NOT NULL,
      acr_email_authenticated binary(14) default NULL,
      acr_email_token binary(32),
      acr_email_token_expires binary(14),
      acr_bio mediumblob NOT NULL,
      acr_notes mediumblob NOT NULL,
      acr_urls mediumblob NOT NULL,
      acr_ip VARCHAR(255) NULL default '',
      acr_filename VARCHAR(255) NULL,
      acr_storage_key VARCHAR(64) NULL,
      acr_type tinyint(255) unsigned default 0,
      acr_areas mediumblob NOT NULL,
      acr_registration char(14) NOT NULL,
      acr_deleted bool NOT NULL,
      acr_rejected binary(14),
      acr_held binary(14),
      acr_user int unsigned NOT NULL default 0,
      acr_comment varchar(255) NOT NULL default '',
      PRIMARY KEY (acr_id),
      UNIQUE KEY (acr_name),
      UNIQUE KEY (acr_email(255)),
      INDEX (acr_email_token),
      INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration)
    ) TYPE=InnoDB;
    
    CREATE TABLE /*$wgDBprefix*/account_credentials (
      acd_id int unsigned NOT NULL auto_increment,
      acd_user_id int unsigned NOT NULL,
      acd_real_name varchar(255) binary NOT NULL default '',
      acd_email tinytext NOT NULL,
      acd_email_authenticated binary(14) default NULL,
      acd_bio mediumblob NOT NULL,
      acd_notes mediumblob NOT NULL,
      acd_urls mediumblob NOT NULL,
      acd_ip VARCHAR(255) NULL default '',
      acd_filename VARCHAR(255) NULL,
      acd_storage_key VARCHAR(64) NULL,
      acd_areas mediumblob NOT NULL,
      acd_registration char(14) NOT NULL,
      acd_accepted binary(14),
      acd_user int unsigned NOT NULL default 0,
      acd_comment varchar(255) NOT NULL default '',
      
      PRIMARY KEY (acd_user_id,acd_id),
      UNIQUE KEY (acd_id)
      
    ) TYPE=InnoDB;
    Now on the page that you have made a thumbnail out of, at the bottom where it says:
    SQL query on database xth_2151371_wiki:
    in the below textarea enter the first piece of SQL code:
    Code:
    CREATE TABLE /*$wgDBprefix*/account_requests (
      acr_id int unsigned NOT NULL auto_increment,
      acr_name varchar(255) binary NOT NULL default '',
      acr_real_name varchar(255) binary NOT NULL default '',
      acr_email tinytext NOT NULL,
      acr_email_authenticated binary(14) default NULL,
      acr_email_token binary(32),
      acr_email_token_expires binary(14),
      acr_bio mediumblob NOT NULL,
      acr_notes mediumblob NOT NULL,
      acr_urls mediumblob NOT NULL,
      acr_ip VARCHAR(255) NULL default '',
      acr_filename VARCHAR(255) NULL,
      acr_storage_key VARCHAR(64) NULL,
      acr_type tinyint(255) unsigned default 0,
      acr_areas mediumblob NOT NULL,
      acr_registration char(14) NOT NULL,
      acr_deleted bool NOT NULL,
      acr_rejected binary(14),
      acr_held binary(14),
      acr_user int unsigned NOT NULL default 0,
      acr_comment varchar(255) NOT NULL default '',
      PRIMARY KEY (acr_id),
      UNIQUE KEY (acr_name),
      UNIQUE KEY (acr_email(255)),
      INDEX (acr_email_token),
      INDEX acr_type_del_reg (acr_type,acr_deleted,acr_registration)
    ) TYPE=InnoDB;
    OK, now PMA should refresh its self, if it goes ok it should say something like this: table `account_requests` was made succesfully, then enter the second piece of code:
    Code:
    CREATE TABLE /*$wgDBprefix*/account_credentials (
      acd_id int unsigned NOT NULL auto_increment,
      acd_user_id int unsigned NOT NULL,
      acd_real_name varchar(255) binary NOT NULL default '',
      acd_email tinytext NOT NULL,
      acd_email_authenticated binary(14) default NULL,
      acd_bio mediumblob NOT NULL,
      acd_notes mediumblob NOT NULL,
      acd_urls mediumblob NOT NULL,
      acd_ip VARCHAR(255) NULL default '',
      acd_filename VARCHAR(255) NULL,
      acd_storage_key VARCHAR(64) NULL,
      acd_areas mediumblob NOT NULL,
      acd_registration char(14) NOT NULL,
      acd_accepted binary(14),
      acd_user int unsigned NOT NULL default 0,
      acd_comment varchar(255) NOT NULL default '',
      
      PRIMARY KEY (acd_user_id,acd_id),
      UNIQUE KEY (acd_id)
      
    ) TYPE=InnoDB;
    And if that all goes well then the 2 tables should be created.

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
  •