Installation:Debian:MySQL

From PMWH2 - PHPMyWebHosting's official wiki
Jump to: navigation, search
up

On Debian GNU/Linux you need to install the following packages:

  • mysql-server
  • mysql-client
  • mysql-common

On Debian GNU/Linux use this command to install all at once:

apt-get install mysql-server mysql-client mysql-common

Let mysql start on boot, so if the server reboots, everything is working again.

First, change the password for root:

bash #> mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A  

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 4.0.16-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> update user set password=password("yoursecrethere") where user="root";
Query OK, 2 rows affected (0.01 sec)
Rows matched: 2  Changed: 2  Warnings: 0

mysql> exit
Bye
bash #> mysqladmin -u root reload

After that we try if the new password works:

bash#> mysql -u root -pyoursecrethere
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.0.16-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit
Bye

Ok, everything works fine. Now we need the database and a user for accessing the database through postfix and courier:

bash #> mysql -u root -p mysql
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 32 to server version: 4.0.16-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE database pmwh;
Query OK, 1 row affected (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP, RELOAD ON *.* TO 'pmwh'@'localhost' identified by "pmwh-password" WITH GRANT OPTION MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0;
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON pmwh.* to 'postfix'@'localhost' identified by "postfix-password";
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye

MySQL setup is done for now.