May 2017 : Notes on setting up mySql to work with wSurvey (on a WAMP server). Several wSurvey applications use mysql to save data (for example, wsEmail). This document describes how to create a mysql account that wSurvey can use. :::::: ::::::::::::: If you are using WAMP (or similar), and have access to the phpMyAdmin utility, these instructions are somewhat deprecated -- there are far easier ways to create the required username! For example, under phpMyAdmin 4.04 (or 4.64) a) Open phpMyAdmin (i.e.; click on the WAMP icon) b) Click the Users tab (or User accounts) c) Click the Add user (or Add user account) link d) In the Login Information area ... For username, select "Use text field:", and enter a username of "wsurveyAdmin" For host, it is simplest to select "local" For password, select "Use text field:", and enter a password of "admin" (in both of the password input fields) (under 4.64: For authentication plugin: for now, use Native Mysql authentication, and do not generate a password) e) In the Database for user area It is simplest NOT to create database for user f) In the Global Privileges area It is simplest to "Check all" (under 4.64: for now, use Require none for SSL) g) Click the Go button You might need to re-start WAMP, but probably not. Note: for some of wSurvey's applications, you can use a different mysql username (i.e.; not "wsurveyAdmin" with an "admin" password) For example, for wsEmail you can modify these values by editing the wsEmailsParams.inc file. ::: ::::::::::::: (If you are here, it is probably because you don't or can't use phpMyAdmin. Otherwise, it is easier to use phpMyAdmin!) Step 1: If you have just installed WAMP, the first thing to do is to change your mysql "root" password. Here is one way to do it. a) Open up a command prompt b) Find the MYSQL directory. For example, if you installed Wamp to C:\wamp, it might be C:\wamp\bin\mysql\mysql5.6.12\bin c) Run mysql using C:\wamp\bin\mysql\mysql5.6.12\bin>mysql -uroot -p d) When asked to "Enter a password", hit the Enter key (the installation default is no password). You will see a welcome message that begins with something like "Welcome to the MySQL monitor". and at the end a prompt that looks like mysql> e)Enter mysql> use mysql; (don't forget the trailing semi-colon) You should a see message like: Database changed f)Enter mysql> update user set password=password('yourPassword’) where host=’localhost’; (you can enter this on one line) (change the yourPassword to your preferred password) You should see a message like: Query OK, 1 row affected (0.00 sec) Example, if your password is 'keving' : mysql>update user set password=password('keving’) where host=’localhost’; g) Enter mysql> flush privileges; h) You can then exit, using mysql> \q To make sure it worked, rerun mysql using: C:\wamp\bin\mysql\mysql5.6.12\bin>mysql -uroot -pyourPassword (of course, the yourPassword should be the password used in step f above) This should take you to the mysql> prompt. i) In order for the phpMyAdmin option of Wamp to work, you need to change the phpMyAdmin configuration file i) Find the phpMyAdmin directory. For example: C:\wamp\apps\phpmyadmin4.0.4 ii) Edit the config.inc.php in this directory iii) Change the $cfg['Servers'][$i]['password'] = '' ; to $cfg['Servers'][$i]['password'] = 'yourPassword' (the yourPassword should be the pasword set in step f above) iii) You may also need to add the following line (under the above 'password' line): (this seems to needed for phpMyAdmin to show the wSurvey mysql databases): $cfg['Servers'][$i]['auth_type'] = 'config'; iv) Save. To make sure this worked, click on the phpMyAdmin choice under the Wamp menu -- the phpMyAdmin screen shoud appear. If you get some kind of error message, some people report that they need to change (in config.inc.php) $cfg['Servers'][$i]['AllowNoPassword'] = false ; or, perhaps add $cfg['Servers'][$i]['AllowNoPasswordRoot'] = false ; Step 2: To create a wsurveyAdmin username for mysql wSurvey assumes that a wsurveyAdmin username exists in mysql. That means you MUST create this username in mySql. You can create this using the following steps: 1) From a command prompt (in the mysql directory) C:\wamp\bin\mysql\mysql5.6.12\bin>mysql --user=root mysql -pmypassword Say, if mysql if your root password (as created in step 0) is keving, then you would use: C:\wamp\bin\mysql\mysql5.6.12\bin>mysql --user=root mysql -pkeving 2) Create a wsurveyAdmin user with the appopriate privileges mysql> CREATE USER 'wsurveyAdmin'@'localhost' IDENTIFIED BY 'admin'; mysql> GRANT ALL PRIVILEGES ON *.* TO 'wsurveyAdmin'@'localhost' -> WITH GRANT OPTION; 3) Verify it worked: mysql> SHOW GRANTS FOR 'wsurveyAdmin'@'localhost'; which should return something like: | GRANT ALL PRIVILEGES ON *.* TO 'wsurveyAdmin'@'localhost' IDENTIFIED BY PASSWORD '*4ACFE3202A5FF5CF467898FC58AAB1D615029441' WITH GRANT OPTION | (the above would appear on one long line)