I have MariaDB version 5.5.39
mysqldump -u root -p database > dumpfile.sql
Yes this is working fine; it produces a dump file.
But I am not able to import this dump file. All these commands are not working:
mysqldump -u root -p database < dumpfile.sql
mysqlimport -u root -p database < dumpfile.sql
mysql -u root -p database < dumpfile.sql
Can anybody help me please?
mysql -u root -p --database=db_name < dumpfile.sql
Related
I am using Apache2 and ubuntu. Before my attempt to install wordpress on my server, i was able to open my domain in browser. But after the commands that i wrote below, i can not open it. When i browse my domain it is giving 403 error
Forbidden You don't have permission to access this resource.
I used the commands below while i was installing wordpress. And now, i am wondering how to fix this situation. And which files or other things should i check. Thank you.
First Commands That I Used For In My Terminal
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
mysql -u root -p
CREATE DATABASE wordpress; Query OK, 1 row affected (0.00 sec)
CREATE USER wordpressuser#localhost; Query OK, 0 rows affected (0.00 sec)
SET PASSWORD FOR wordpressuser#localhost= PASSWORD("password"); Query OK, 0 rows affected (0.00 sec)
GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser#localhost IDENTIFIED BY 'password'; Query OK, 0 rows affected (0.00 sec)
FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)
cp ~/wordpress/wp-config-sample.php ~/wordpress/wp-config.php
sudo nano ~/wordpress/wp-config.php
// ** MySQL settings - You can get this info from your web host ** // /** The name of the database for WordPress */ define('DB_NAME', 'wordpress'); /** MySQL database username */ define('DB_USER', 'wordpressuser'); /** MySQL database password */ define('DB_PASSWORD', 'password');
sudo rsync -avP ~/wordpress/ /var/www/
cd /var/www/
sudo chown username:www-data /var/www -R sudo chmod g+w /var/www -R
sudo apt-get install php5-gd
As These Commands Above Didnt Work for me I used Other Commands Below After Deleting Wordpress Directory
cd /var/www/html
sudo wget https://wordpress.org/latest.tar.gz
sudo tar xvfz latest.tar.gz
sudo chown www-data.www-data wordpress/
Those Commands Also Didnt Work For Me So I Added The Other Ones Below
sudo mkdir -p /var/www/html/example.com/src/
cd /var/www/html/example.com/src/
chmod 755 /var/www/html
chmod 750 /var/www
sudo chown -R www-data:www-data /var/www/html/example.com/
sudo wget http://wordpress.org/latest.tar.gz
sudo -u www-data tar -xvf latest.tar.gz
sudo mv latest.tar.gz wordpress-`date "+%Y-%m-%d"`.tar.gz
sudo mkdir /var/www/html/example.com/public_html/
sudo mv wordpress/* ../public_html/
sudo chown -R www-data:www-data /var/www/html/example.com/public_html
These are the access and error logs in my apache2. Which one should i paste?
access and error files in apache2
I replicated your steps on Ubuntu 20.04.3 LTS and it works fine. Here are my steps.
sudo su
apt install apache2
apt install mysql-server
wget http://wordpress.org/latest.tar.gz
tar -xzvf latest.tar.gz
rsync -avP ./wordpress/ /var/www/html
cd /var/www/html
rm index.html
apt install php-mysql
mysql
mysql> CREATE DATABASE wordpress;
mysql> CREATE USER wordpressuser#localhost;
mysql> ALTER USER wordpressuser#localhost IDENTIFIED BY 'pass';
mysql> GRANT ALL PRIVILEGES ON wordpress.* TO wordpressuser#localhost ;
mysql> FLUSH PRIVILEGES;
systemctl restart apache2
If it doesn't work please paste your /var/log/apache2/error.log, your os-release and output of php -v.
I used the following command from shell to export the schema of the database:
mysqldump -u username -p -no-data database_name> gs://test.sql
I got the following error:
mysqldump: unknown option '-o'.
Then instead I used this:
mysqldump -u username -p -d database_name, ( -d instead of -no-data flag)
I got this error:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2 "No such file or directory")
When trying to connect.
Any idea how to export only table definitions in the schema and not all the database.
You're missing the hostname.
mysqldump -h hostname -u username -p -d database_name
I am trying to leverage the power of elastic beanstalk with a fresh wordpress install. To keep it stateless I am trying to use EFS to persist wp-content files between ec2 instances, but for some reason I can't get my EFS setup to persist my wp-content folder.
The following is my efs.config file.
packages:
yum:
nfs-utils: []
jq: []
files:
"/tmp/mount-efs.sh" :
mode: "000755"
content: |
#!/usr/bin/env bash
mkdir -p /mnt/efs
EFS_NAME=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_NAME')
mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $EFS_NAME:/ /mnt/efs || true
mkdir -p /mnt/efs/wp-content
chown webapp:webapp /mnt/efs/wp-content
mkdir -p /mnt/efs/wp-content/themes
chown webapp:webapp /mnt/efs/wp-content/themes
mkdir -p /mnt/efs/wp-content/plugins
chown webapp:webapp /mnt/efs/wp-content/plugins
mkdir -p /mnt/efs/wp-content/uploads
chown webapp:webapp /mnt/efs/wp-content/uploads
commands:
01_mount:
command: "/tmp/mount-efs.sh"
container_commands:
01-rm-wp-content-uploads:
command: rm -rf /var/app/ondeck/wp-content
02-symlink-uploads:
command: ln -snf /mnt/efs/wp-content /var/app/ondeck/wp-content
It seems like it's mounting and deleting the files? Each time when a new instance is auto created I was able to ssh into the instance and see the new instance mount a wp-content folder but without my existing files?
Thanks in Advance!
Also, would I be able to see what files are in EFS directly in the AWS console?
Thanks.
You need setup to mount your efs folder automatically when your instance reboots.
Follow the steps which mention in this article.
http://docs.aws.amazon.com/efs/latest/ug/mount-fs-auto-mount-onreboot.html
I get this error when I tried to deploy symfony in a Docker swarm node
ContextErrorException in Kernel.php line 338:
Warning: file_put_contents(/home/backend_microservice/private_webapp/var/cache/dev/classes.map): failed to open stream: No such file or directory
I tried to remove the cache manually, I remove the vendor directory and I generate a new one with composer, but still give the same error.
The same config works fine with only docker engine but does not work in swarm mode.
OS : CentOS 7.3
Virtualization : Docker version 17.06.0-ce, build 02c1d87 Swarm mode
Symfony :3.2.9
Any help or suggestion??
thank you in advance.
OK, I managed to generate the cache. I was not able to write to the cache directory even when I change the permission to the 777. So, I just remove the following lines from the docker start script - which is recommended by the symfony doc :-( :
HTTPDUSER=ps axo user,comm | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1
&& setfacl -R -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var
&& setfacl -dR -m u:"$HTTPDUSER":rwX -m u:whoami:rwX var
Is there any way of Deploying ASP.NET 4.* MVC and Web API applications to Linux server? I searched and read about Docker but I think that is for .NET 5.
Appreciate your help!
I managed to do that with some bricolage on a Linux-based Docker image.
This helped me a lot: https://github.com/junalmeida/docker-mono-web
Basically, you can host your web application with nginx, but you also need fastcgi-mono-server4.
The dockerfile looks like this:
FROM mono:latest
RUN apt-get update \
&& apt-get install -y \
iproute2 supervisor ca-certificates-mono fsharp mono-vbnc nuget \
referenceassemblies-pcl mono-fastcgi-server4 nginx nginx-extras \
&& rm -rf /var/lib/apt/lists/* /tmp/* \
&& echo "daemon off;" | cat - /etc/nginx/nginx.conf > temp && mv temp /etc/nginx/nginx.conf \
&& sed -i -e 's/www-data/root/g' /etc/nginx/nginx.conf
# this copies nginx configuration files to the proper directory
COPY nginx/ /etc/nginx/
In the link above, the supervisord command is used to start both nginx and fastcgi-mono-server4.
It is configured in a supervisord.conf file like the following, in which the --appconfigdir specifies the root folder of your application:
[supervisord]
logfile=/var/log/supervisor/supervisord.log
logfile_maxbytes = 50MB
nodaemon=true
user=root
[program:mono]
command=fastcgi-mono-server4 --appconfigdir=appconfig --socket=unix --filename=/var/run/mono-fastcgi.sock --printlog --name=mono
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
[program:nginx]
command=nginx
user=root
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
stderr_logfile=/dev/stderr
stderr_logfile_maxbytes=0
and launched with this command:
/usr/bin/supervisord -c supervisord.conf
(a folder contains a configuration for nginx, too).