lattepanda with fedora server 25 can't use mysqld command - mysql

already installed mysql-server package but it doesn't work
Package mariadb-server-3:10.1.21-3.fc25.x86_64 is already installed, skipping.
Dependencies resolved.
Nothing to do.
Complete!
[root#localhost ~]# /etc/rc
rc0.d/ rc1.d/ rc2.d/ rc3.d/ rc4.d/ rc5.d/ rc6.d/ rc.d/
[root#localhost ~]# /etc/rc.d/init.d/mysqld start
-bash: /etc/rc.d/init.d/mysqld: No such file or directory

Fedora is using systemd so you should use systemctl for starting services:
systemctl start mysqld

Related

How to go to mysql database host on Linux CLI in RedHat 8

I installed mariadb using
# yum install mariadb mariadb-sever
Then on running:
# systemctl start mariadb
I got:
# Failed to start mariadb.service: Unit mariadb.service not found
& on running:
# systemctl restart mysqld
I got:
# Failed to restart mysql.service: Unit mysql.service not found
Simply install, activate at boot + start mysql executable :
yum install mariadb mariadb-server
systemctl enable --now mariadb.service
You need to:
yum install mariadb mariadb-server
mariadb-server package contains the server daemon
mariadb package contains the CLI client

Error "Failed to start mariadb.service: Unit mariadb.service not found"

I'm using Fedora 29.
I'm try to run mariadb.service with command: systemctl start mariadb, and give error: Failed to start mariadb.service: Unit mariadb.service not found.
Also, I tried next commands:
systemctl status mariadb
Unit mariadb.service could not be found.
systemctl start mariadb.service
Failed to start mariadb.service: Unit mariadb.service not found.
systemctl start mysql
Failed to start mysql.service: Unit mysql.service not found.
systemctl enable mariadb
Failed to enable unit: Unit file mariadb.service does not exist.
systemctl daemon-reload
<nothing to output>
I trying this with sudo and without. The result is same.
mariadb-server is installed:
dnf install mariadb-server
Package mysql-community-server-8.0.15-1.fc29.x86_64 already installed.
Just starting to use Linux, I can not understand what's the trouble.
You have MySQL 8 installed which is why your installation of MariaDB failed: the two conflict and you must pick which one you want.
If you want to install MariaDB, you first have to uninstall MySQL 8 first:
dnf remove mysql-community-server
dnf install mariadb-server
Historically, both MySQL and MariaDB used to use mysql as the service name. The MySQL 8 package uses only the mysql service name whereas MariaDB has both mariadb and mysql services, the latter being an alias to the mariadb one.
MariaDB added its own service name quite early on in the 10 series of releases and has added aliases for other commands as well. For example, the mariadb command is the same program as the mysql command in MariaDB 10.5.
It was quite confusing to me too. I followed several instructions found online but it seems that even talking about the same version 5.5 there are quite a few different ways to start the service after installation. I finally accidentally tried mysql and it worked.
when seeing this after a successful installation:
Installed: MariaDB-server.x86_64 0:5.5.67-1.el7.centos
Dependency Installed: MariaDB-client.x86_64 0:5.5.67-1.el7.centos
Complete!
and I tried:
$ sudo systemctl start mariadb
Failed to start mariadb.service: Unit not found.
and I tried:
$ sudo systemctl start mysql
there was a silence.
and I tried:
$ sudo systemctl status mysql
It said it's active(running).
you can use rpm -ql mysql-community-server-8.0.15-1 in order to find where the package is installed. then you can find executables from this path and try to run it

In CentOS7, can not start MySQL

I want use MySQL on CentOS7.
installed MySQL package using yum.
[root#node01 ~]# yum install mysql mysql-*
then,
[root#node01 ~]# systemctl start mysqld.service
Failed to issue method call: Unit mysqld.service failed to load: No such file or directory.
i can not execute MySQL. How can i solve this problem?
when you run
yum install mysql
command by default it installs mariadb not mysql. so try this following command
yum list installed | grep mariadb
if mariadb-server is missing try this following command
yum install mariadb-server
it installs the server package then start the service
systemctl start mariadb
or
service mariadb start
My issue is solved in this way.
Thanks
To check for the required packages, type the given command:
$ rpm -qa | grep mariadb
Output:
mariadb-libs-5.5.44-2.el7.centos.x86_64
mariadb-5.5.44-2.el7.centos.x86_64
mariadb-devel-5.5.44-2.el7.centos.x86_64
mariadb-server-5.5.44-2.el7.centos.x86_64
If the last package is absent, type the given commands:
$ sudo yum -y install mariadb-server
$ sudo systemctl start mariadb
$ cat /etc/redhat-release
Output:
CentOS Linux release 7.2.1511 (Core)
Check /etc/init.d/ for your mysql service name and then
service mysql_service_name start
On centos it is either:
service mysqld start
or for MariaDB:
service mariadb start
mysql-community-common appears to be installed along with Red Hat-based *nix v7 installs and it in turn conflicts with mariadb installation. I'm using Oracle Linux 7, just ran into this. After a fresh install of OL7, mysql-community-common and mysql-community-libs are installed. Remove mysql-community-common THEN install mariadb and everything works like a champ.
root#ol7-101:~> yum list installed | grep mysql
mysql-community-common.x86_64 5.6.27-2.el7 #Server-Mysql/7.2
mysql-community-libs.x86_64 5.6.27-2.el7 #Server-Mysql/7.2
root#ol7-101:~>
root#ol7-101:~> yum install mariadb-server mariadb -y
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
[...]
86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
file /usr/share/mysql/spanish/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
file /usr/share/mysql/swedish/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
file /usr/share/mysql/ukrainian/errmsg.sys from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
file /usr/share/mysql/errmsg-utf8.txt from install of MariaDB-server-10.1.11-1.el7.centos.x86_64 conflicts with file from package mysql-community-common-5.6.27-2.el7.x86_64
Error Summary
-------------
root#ol7-101:~> systemctl start mariadb
Failed to start mariadb.service: Unit mariadb.service failed to load: No such file or directory.
root#ol7-101:~> systemctl enable mariadb.service
Failed to execute operation: Access denied
root#ol7-101:~>
root#ol7-101:~> yum erase mysql-community-common.x86_64
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-common.x86_64 0:5.6.27-2.el7 will be erased
--> Finished Dependency Resolution
[...]
root#ol7-101:~> yum install mariadb mariadb-libs mariadb-server -y
Loaded plugins: ulninfo
Resolving Dependencies
--> Running transaction check
[...]
Complete!
root#ol7-101:~> systemctl start mariadb.service
root#ol7-101:~>
root#ol7-101:~> systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
root#ol7-101:~>
CentOS7 use mariaDB replaced Mysql, you can use mariaDB as same as Mysql. Or you can download repo from mysql.com. And then you can install mysql

Install MySQL in fedora

I am installing mysql and mysql-server in fedora.What I did was:
su (to change to root)
yum install mysql mysql-server
chkconfig --levels 235 mysqld on
and when I try to start mysqld using /etc/init.d/mysqld start, it gives me an error saying No such a file or directory.
By using whereis mysql I got the following result:
$whereis mysql
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz
Can some one help me find where I installed mysql and how I can start it? Thank you
Try starting MySQL by using service mysqld start instead.

How to start MySQL server from command line on Mac OS Lion?

I installed mySQL on my Mac. Beside starting the SQL server with mySQL.prefPane tool installed in System Preferences, I want to know the instructions to start from command-line.
I do as follows:
After
su root
I start the mySQL server by command-line, but it produces an error as below:
sh-3.2# /usr/local/mysql/bin/mysqld
111028 16:57:43 [Warning] Setting lower_case_table_names=2 because
file system for /usr/local/mysql-5.5.17-osx10.6-x86_64/data/ is case
insensitive
111028 16:57:43 [ERROR] Fatal error: Please read "Security" section of
the manual to find out how to run mysqld as root!
111028 16:57:43 [ERROR] Aborting
111028 16:57:43 [Note] /usr/local/mysql/bin/mysqld: Shutdown complete
Simply:
mysql.server start
mysql.server stop
mysql.server restart
Try /usr/local/mysql/bin/mysqld_safe
Example:
shell> sudo /usr/local/mysql/bin/mysqld_safe
(Enter your password, if necessary)
(Press Control-Z)
shell> bg
(Press Control-D or enter "exit" to exit the shell)
You can also add these to your bash startup scripts:
export MYSQL_HOME=/usr/local/mysql
alias start_mysql='sudo $MYSQL_HOME/bin/mysqld_safe &'
alias stop_mysql='sudo $MYSQL_HOME/bin/mysqladmin shutdown'
I like the aliases too ... however, I've had issues with MySQLCOM for start ... it fails silently ... My workaround is akin to the others ... ~/.bash_aliases
alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start'
alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop'
As this helpful article states:
On OS X to start/stop MySQL from the command line:
sudo /usr/local/mysql/support-files/mysql.server start
sudo /usr/local/mysql/support-files/mysql.server stop
On Linux start/stop from the command line:
/etc/init.d/mysqld start
/etc/init.d/mysqld stop
/etc/init.d/mysqld restart
Some Linux flavours offer the service command too
# service mysqld start
# service mysqld stop
# service mysqld restart
or
# service mysql start
# service mysql stop
# service mysql restart
If you installed it with homebrew, the binary will be somewhere like
/usr/local/Cellar/mysql/5.6.10/bin/mysqld
which means you can start it with
/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server start
and stop it with
/usr/local/Cellar/mysql/5.6.10/support-files/mysql.server stop
Edit: As Jacob Raccuia mentioned, make sure you put the appropriate version of MySQL in the path.
Maybe your mysql-server didn't start.
You can try
/usr/local/bin/mysql.server start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM start
sudo /Library/StartupItems/MySQLCOM/MySQLCOM stop
make alias in .bash_profile
alias start_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM start"
alias stop_mysql="/Library/StartupItems/MySQLCOM/MySQLCOM stop"
and if you are trying to run as root use following safe mode
sudo ./bin/mysqld_safe
if you are still having issues starting, a recommended read:
mysql5.58 unstart server in mac os 10.6.5
For me this solution worked on mac Sierra OS:
sudo /usr/local/bin/mysql.server start
Starting MySQL
SUCCESS!
My MySQL is installed via homebrew on OS X ElCaptain. What fixed it was running
brew doctor
which suggested that I run
sudo chown -R $(whoami):admin /usr/local
Then:
brew update
mysql.server start
mysql is now running
If it's installed with homebrew try just typing down mysql.server in terminal and that should be it.
AFAIK it executable will be under /usr/local/bin/mysql.server.
If not you can always run following "locate mysql.server" which will tell you where to find such file.
If you have MySQL installed through Homebrew these commands will help you:
# For starting
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
# For stoping
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
MySql server startup error 'The server quit without updating PID file '
if you have installed mysql from homebrew
close mysql server from preferences of mac
ps ax | grep mysql
#kill all the mysql process running
sudo kill -9 pid
which mysql
/usr/local/bin/mysql
Admins-MacBook-Pro:bin username$ sudo mysql.server start
Starting MySQL
. SUCCESS!
Admins-MacBook-Pro:bin username$ which mysql
/usr/local/bin/mysql
Admins-MacBook-Pro:bin username$ ps ax | grep mysql
54916 s005 S 0:00.02 /bin/sh
/usr/local/Cellar/mysql#5.7/5.7.27_1/bin/mysqld_safe --datadir=/usr/local/var/mysql --pid-file=/usr/local/var/mysql/Admins-MacBook-Pro.local.pid
55012 s005 S 0:00.40 /usr/local/Cellar/mysql#5.7/5.7.27_1/bin/mysqld --basedir=/usr/local/Cellar/mysql#5.7/5.7.27_1 --datadir=/usr/local/var/mysql --plugin-dir=/usr/local/Cellar/mysql#5.7/5.7.27_1/lib/plugin --user=mysql --log-error=Admins-MacBook-Pro.local.err --pid-file=/usr/local/var/mysql/Admins-MacBook-Pro.local.pid
55081 s005 S+ 0:00.00 grep mysql
On mac Big Sur and MySQL 5.7, I needed to stop/start with:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
and
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
This answer came from https://coolestguidesontheplanet.com/start-stop-mysql-from-the-command-line-terminal-osx-linux/
In my case, I had downloaded the mysql server and installed it but I didn't click on the run server that showed up on the last installer page.
In order to start my server manually in the terminal (without adding aliases), I used this in the terminal and it works.
Start Server:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Stop Server:
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
More info at the link below:
https://www.databasestar.com/start-mysql-server/
111028 16:57:43 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!
Have you set a root password for your mysql installation? This is different to your sudo root password. Try /usr/local/mysql/bin/mysql_secure_installation