Score:0

Ubuntu Wordpress server tutorial error

us flag

I am going through the WordPress installation tutorial from Ubuntu Tutorials and I have typed this command as part of Step 6:

sudo -u www-data sed -i ‘s/database_name_here/wordpress’ /srv/www/wordpress/wp-config.php

And I get the error:

sed: -e expression #1, char 30: undetermined ‘s’ command

Please help I cannot find anyone else having the same issue.

Nmath avatar
ng flag
See the answer @matigo. If you copy/paste from the tutorial you should not get these syntax issues. With commands that need to be changed, copy first to a notepad or text editor
us flag
How can I copy paste when I’m doing this on a copy of Ubuntu server
Score:2
in flag

You will want to make sure that the quote in your command is not a "curly quote", like the ones in the command you shared; and ' mean different things.

However, you can simplify this for yourself by skipping the three sed commands they suggest and just opening the file for editing, which they ask you to do anyway:

sudo -u www-data nano /srv/www/wordpress/wp-config.php

In the file, you can replace database_name_here with your proper database name, username_here with the MySQL account name, and password_here with the MySQL account password. Remember that you cannot use root as the account name, so a proper WordPress-specific account will be needed.

In the event you need to configure these in MySQL, you can do this:

  1. Connect to MySQL as an administrator. For example:
    sudo mysql
    
  2. Create the database if it does not already exist:
    CREATE DATABASE `words` DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
    
  3. Create a user account that WordPress can use:
    CREATE USER 'wpress'@'localhost' IDENTIFIED WITH mysql_native_password BY 'superSecretPassword!123';
    
  4. Grant permissions to the WordPress database, including the ability to create new tables:
    GRANT ALL ON `words`.* TO 'wpress'@'localhost';
    

Be sure to replace the name of the database, the user account, and the password with ones that you would prefer. These values should match the values in your wp-config.php file.

us flag
I did as you suggested and then on step 7 I had to use another computer on the same network to go to the http://‘server IP address’ and it says error establishing a database connection
in flag
Have you created a MySQL user and an empty database for Wordpress? Was the user given access to the database?
us flag
I know the database is there because I went to create it again and it said it already existed but I did the same for the Wordpress user and it didn’t say it already existed it just said Query OK, 0 rows affected
us flag
I tried to create a user with a different name and got the same output. Does this mean my user was not created? And if so why not? I did it exactly like the tutorial.
in flag
I have updated the answer to show the steps you’ll need to follow for MySQL. Some you have likely done, but all are required.
us flag
Thank you I will try this tomorrow and update the post after.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.