Problem setting Privileges on mysql


New Member
Mar 26, 2023
Reaction score
I am attempting to install Word Press on my Linux Mint machine. I am new to Linux Mint but was trained in UNIX aka Sun Solaris so not a complete novice aka UNIX. I have installed the LAMP stack components. using sudo apt install apache2 mysql-server php php-mysql1 Then I logged into mysql as using sudo -u root - p. The prompt showed me I was in mysql. Using CREATE DATABASE fred1 (Does one have to do the commands in UPPER CASE - assuming one does) I created the Database fred1. Then I tried to set up the privileges using: GRANT ALL PRIVIlEGES ON fred1.* TO 'myusername'@'localhost' IDENTIFIED BY 'new strong password'. But it gave me an error saying with the syntax. Saying consult your version of mysql. Is there a manual/userguid on line for the mysql that comes from the LAMP stack apache2 intasll.

did you put a semicolon ";" at the end of each line you typed? That is how you delimit the commands. I have found that sometimes you do not need it and sometimes you do. So I always do it. Also the names of fields and tables and databases are case sensitive. You also mispelled "PRIVIIEGES" assuming that to be a typo here not on the terminal.

mysql has a huge amount of documentation online all over the place.
please use the code block to format code like this:


You can use three semicolons ``` to start and finish the code block, or press this code block button in the forum text editor gui thingy

1. Install Apache Web Server :​

To install Apache webserver follow the command below :

sudo apt-get install apache2 apache2-utils
Now we need to enable Apache2 web server :

sudo systemctl enable apache2
sudo systemctl start apache2
Note: The Apache default root directory is /var/www/html, all your web files will be stored in this directory.

To test Apache server, open your web browser and enter http://server_address. The Apache2 default index page will be displayed.

2. Install MySQL Database Server :​

After installation of Apache web server, we need to install MySQL database server.

To install MySQL Database server follow the command below :

sudo apt-get install mysql-client mysql-server
During the installation of MySQL, you need to set the root user password. Choose a strong and secure password.

3. Install PHP:​

To install PHP using the command below :

sudo apt-get install php7.0 php7.0-mysql libapache2-mod-php7.0 php7.0-cli php7.0-cgi php7.0-gd
To test that PHP is working or not with the web server, create a info.php file inside /var/www/html by follow the given command :

sudo vi /var/www/html/info.php
An editor will be open, now you have to paste the given code into the file.


Now open your web browser and type http://server_address/info.php. You will see a PHP info page

4. Install The WordPress CMS:​

To install the WordPress, you have to download the latest package of WordPress. After download, extract the downloaded package.

To download and extract the latest package you need to follow these command one by one:

wget -c
tar -xzvf latest.tar.gz
After extracting, move the WordPress file from the extracted folder to the Apache default root directory /var/www/html/.

sudo rsync -av wordpress/* /var/www/html/
Now the important work during installation of WordPress is to set the permission.

sudo chown -R www-data:www-data /var/www/html/
sudo chmod -R 755 /var/www/html/

5. Create WordPress Database :​

Provide the root user password using the below command :

mysql -u root -p
A MySQL shell will be open, type the following command one by one :

mysql> CREATE DATABASE wordpressdatabase;
mysql> GRANT ALL PRIVILEGES ON wordpressdatabase.* TO 'your_username_here'@'localhost' IDENTIFIED BY 'your_chosen_password_here';
mysql> EXIT;
Go to the /var/www/html/ directory and rename existing wp-config-sample.php to wp-config.php

Now open and edit the wp-config.php file and save by pressing Ctrl+s:

sudo gedit wp-config.php
In the wp-config file, set database_name, database_user_name and password according to MySQL shell.

After that, restart the web server and MySQL service using the commands below:

sudo systemctl restart apache2.service
sudo systemctl restart mysql.service

Open your web browser and enter localhost to get the WordPress installation page. Now, you need to enter some information here and then you can now enjoy WordPress on your system.