How to install 'systemctl' on Ubuntu (docker)? - mysql

I have a docker with Ubuntu 16.04 and trying to install mysql-server in it.
Installation went fine (apt-get install -y mysql-server) and now is time to run a server:
systemctl status mysql
Failed to connect to bus: No such file or directory
How to find/install systemctl for Ubuntu 16.04 (docker) and are there alternatives?

Systemd is not installed on the ubuntu docker image. You can use the "service" command
service mysql start
service mysql status
You can also use the mysql docker image instead of installing mysql manually on ubuntu.

Ubuntu 16.04 is based on systemd, and systemctl tries to contact the daemon via d-bus. There are a number of solutions to solve this problem, one may be docker-systemctl-replacement.

Related

Problems installing MySQL 5.7 properly on fresh CentOS 7 install

I admit that I am new to back-end work in general and I seem to be stuck (for several hours) following through with completing the setting up process for Magento 2.3
I was following https://devdocs.magento.com/guides/v2.3/install-gde/prereq/mysql.html for my commands but to no success.
I managed to get the following installed:
Cent OS 7 (x86_64)
Apache 2.4.6
PHP 7.2.14 (all the extensions installed passed the Setup Wizard readiness check)
I used these commands to install MySQL 5.7 Community Release: (from the documentation)
wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
yum -y install mysql mysql-server
yum -y install mysql-community-server
To check if my installation went well, when I run:
mysql --version
I received an error message saying:
-bash: /usr/bin/mysql: No such file or directory
I know that there is something I definitely am missing out completely. When I try to start the MySQL service using the command:
systemctl start mysqld
I get the resulting error message:
Failed to start mysqld.service: Unit not found.
Any suggestions will much be appreciated. Thank you in advance.
Maybe it installed it as mariadb?
systemctl start mariadb
After removing MySQL 5.7 community release from my Cent OS, I decided to install MariaDB.
Inside the directory /etc/yum.repos.d/ I've created a file called MariaDB.repo and added this into the file:
# MariaDB 10.3 CentOS repository list - created 2019-01-25 05:36 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
I then performed the command in my terminal window:
sudo yum install MariaDB-server MariaDB-client
Because of this, mysql --version and systemctl start mysql works like a charm. Thanks #greenberet123 and #danblack for the suggestion.

how to use my database on AWS

I'm using linux, and I've been trying to import my database mysql to my AWS instance, I downloaded all the tools.
php, mysql-server,apache2 and the AWS instance is running.
I'm using FileZilla to upload the files, and I'm connected to the server fine, but whenever I try to open myphpadmin it won't work, showing me weird things on the screen.
Adding a pic for reference
It's not about the AWS; you should prepare the LAMP env at first.
To install and start the LAMP web server with the Amazon Linux AMI
sudo yum update -y
sudo yum install -y httpd24 php70 mysql56-server php70-mysqlnd
sudo service httpd start
sudo chkconfig httpd on
For more info read the following article
Tutorial: Install a LAMP Web Server with the Amazon Linux AMI

Maria DB (mysql) installation on Red Hat . How do I start service after installation

I have installed mysql (maria db) on redhat.
My question is - how do I start and stop the server?
STEPS
I ran the command
$sudo yum install mysql
It gave long messages in the console while installing and and at the end said
Installed:
mariadb.x86_64 1:5.5.41-2.el7_0
Dependency Installed:
perl.x86_64 4:5.16.3-285.el7 perl-Carp.noarch 0:1.26-244.el7 perl-Encode.x86_64 0:2.51-7.el7 perl-Exporter.noarch 0:5.68-3.el7
perl-File-Path.noarch 0:2.09-2.el7 perl-File-Temp.noarch 0:0.23.01-3.el7 perl-Filter.x86_64 0:1.49-3.el7 perl-Getopt-Long.noarch 0:2.40-2.el7
perl-HTTP-Tiny.noarch 0:0.033-3.el7 perl-PathTools.x86_64 0:3.40-5.el7 perl-Pod-Escapes.noarch 1:1.04-285.el7 perl-Pod-Perldoc.noarch 0:3.20-4.el7
perl-Pod-Simple.noarch 1:3.28-4.el7 perl-Pod-Usage.noarch 0:1.63-3.el7 perl-Scalar-List-Utils.x86_64 0:1.27-248.el7 perl-Socket.x86_64 0:2.010-3.el7
perl-Storable.x86_64 0:2.45-3.el7 perl-Text-ParseWords.noarch 0:3.29-4.el7 perl-Time-HiRes.x86_64 4:1.9725-3.el7 perl-Time-Local.noarch 0:1.2300-2.el7
perl-constant.noarch 0:1.27-2.el7 perl-libs.x86_64 4:5.16.3-285.el7 perl-macros.x86_64 4:5.16.3-285.el7 perl-parent.noarch 1:0.225-244.el7
perl-podlators.noarch 0:2.5.1-3.el7 perl-threads.x86_64 0:1.87-4.el7 perl-threads-shared.x86_64 0:1.43-6.el7
But now when I run the command
$ sudo service mysql start
it gives messages
Redirecting to /bin/systemctl start mysql.service Failed to issue
method call: Unit mysql.service failed to load: No such file or
directory.
I am using Red hat version - Red Hat Enterprise Linux Server release 7.1 (Maipo)
I believe you've installed only the client. For the server do yum install mariadb-server. The package will install appropriate service file for you.
The name of the service though is mariadb. Well that is the case on CentOS 7 at least... So, after you install mariadb-server package do systemctl enable mariadb and systemctl start mariadb.
The service is called mysqld, not mysql. So:
$ service mysqld start
Or better yet, use the proper systemd syntax:
$ systemctl start mysqld

ubuntu 12.04 into docker "service mysql start"

I need ubuntu 12.04 with developing web-services running (sshd, apache2.2, php5.3, mysql-server). I have ubuntu 14.04, i installed docker.
Then i started container:
docker run -t -i ubuntu:12.04 /bin/bash
Then:
apt-get update && apt-get install -y mysql-server
After that: service mysql start, service mysql status is not working. If i am running container with 14.04 ubuntu, it works well. The same issue is with sshd server.
service apache2 status, service apache2 stop, service apache2 start works well.
There is no init process running inside the container. Therefore the runelevel can't be determined.
If there is an unknown runlevel, upstart can not start mysql. ... see /etc/init/mysql.conf
...
start on runlevel [2345]
...
If you try to check the runlevel:
$ runlevel
unknown
... you see it is unknown.
In Docker it is the common way to start the application in foreground.
/usr/bin/mysqld_safe
If you want to start more than one application, you can use supervisord.
http://supervisord.org/
https://docs.docker.com/articles/using_supervisord/
Additional i've found a Dockerfile, which starts a init inside a ubuntu:12.04 docker container. Really nice work:
https://github.com/tianon/dockerfiles/blob/master/sbin-init/ubuntu/upstart/12.04/Dockerfile

how to start mysql2 server?

I am trying to get some open source code running on my local machine. It uses mysql2, and I have not used this database before. I had some errors I was able to fix by running:
sudo apt-get install libmysql-ruby libmysqlclient-dev
I start up the rails server but when I go to http://localhost:3000/, I get the following error:
Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Do I need to start the MySQL server? How would I do that?
If you have your gem installed, start mysql before you run $ rails server
$ mysql.server start
To install MySql database:
sudo apt-get install mysql-server
To start MySql server:
/etc/init.d/mysql start
To stop MySql server:
/etc/init.d/mysql stop
To restart MySql server:
/etc/init.d/mysql restart
To check the status of MySql server:
/etc/init.d/mysql status
There is no mysql2 server. mysql2 is the name of a MySQL client gem (Ruby library). All you need is to install and start MySQL server.
It seems your server is Debian or Ubuntu. Execute apt-get install mysql-server to install MySQL. Your MySQL server will automatically start (by Upstart on Ubuntu or sysinit on Debian).
Just type command on terminal
/opt/lampp/lampp start if you have lamp server.Please let me know is it working for you,either I'll do other thing.