I have mariadb in my ubuntu system but it is not working properly , so i want to again install mysql in my system .
For Remove mariadb i have run these commands .
sudo apt-get --purge remove "mysql*"
sudo mv /etc/mysql/ /tmp/mysql_configs/
nano /etc/apt/sources.list
sudo apt-get update
sudo apt-get install mysql-server-5.6
but after step 5 it's give me these errors :
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
libmysqlclient18 : Depends: mysql-common (= 5.6.30-1ubuntu14.04)
mariadb-server-5.5 : Breaks: mysql-server-5.6
Breaks: virtual-mysql-server
mariadb-server-core-5.5 : Conflicts: mysql-server-5.6
mysql-server-5.6 : Depends: mysql-client-5.6 (>= 5.6.30-0ubuntu0.14.04.1)
Depends: mysql-server-core-5.6 (= 5.6.30-0ubuntu0.14.04.1)
Recommends: mysql-common-5.6 but it is not going to be installed
Breaks: virtual-mysql-server
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main amd64 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-amd64_Packages)
W: Duplicate sources.list entry http://debian.datastax.com/community/ stable/main i386 Packages (/var/lib/apt/lists/debian.datastax.com_community_dists_stable_main_binary-i386_Packages)
W: You may want to run apt-get update to correct these problems
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Can anyone give me suggestion how can i install mysql in my system . Thanks in advance .
First of all, you need to update the system.
sudo apt update && upgrade
then perform the MySQL installation commands and follow the instructions.
sudo apt install mysql-server
sudo mysql_secure_installation
Once it has done. try to open MySQL.
sudo mysql
try to check the authentication method each of your MySQL user accounts uses with the following command in the MySQL terminal:
SELECT user,authentication_string,plugin,host FROM mysql.user;
this will return users with authentication_string.
Change the MySQL root password with the following command.
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
FLUSH PRIVILEGES;
Flush Privileges which tells the server to reload the grant tables and put your new changes into effect
It's very simple to install mysql on ubuntu , just follow these steps :
Step 1 : update the system
sudo apt update
Step 2 : Install mysql package
sudo apt install mysql-server
Step 3 : Once the installation is completed, the MySQL service will start automatically. To check whether the MySQL server is running, type:
sudo systemctl status mysql
The output of the following command should be :
OUTPUT
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-20 11:30:23 PDT; 5min ago
Main PID: 17382 (mysqld)
Tasks: 27 (limit: 2321)
CGroup: /system.slice/mysql.service
`-17382 /usr/sbin/mysqld --daemonize --pid-file=/run/mysqld/mysqld.pid
Step 4 : Securing MySQL
sudo mysql_secure_installation
select one of the three levels of password validation policy(strong recommended).Set your password ,and then type y(yes) to all the questions , this will improve the security .
Step 5 : Once it has done. open MySQL by typing the following command :
sudo mysql
Step 6 : If you want to login to your MySQL server as root from an external program such as phpMyAdmin , then type these commands inside mysql.
mysql>ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'strong_password';
mysql>FLUSH PRIVILEGES;
mysql>exit;
After this you will be successfully able to run mysql , for this open terminal and type.
mysql -u root -p
Now type your password.
Congo! you are done with installing mysql.
Lesson from continuous deployment test. You MUST do this purge mysql-common. You CANNOT put mariadb and mysql in the same system, they want their own mysql-common and not sharing them. Which many other API wrapped around it to connect to those server.
And you must comment all the repo pointing to mariadb. Otherwise it will install the same version again from mariadb.
sudo apt-get purge mysql-common
# Put back the mysql-common , make sure you use the new mysql repo,
# remarks mariadb repo
sudo apt-get install software-properties-common
Always check whether any OTHER file or folder contains mariadb repo.
cd /etc/apt
fgrep -lR "maria"
The easy way for this is installing the synaptic package manager by typing the following command in the terminal:
sudo apt-get install synaptic
And then open synaptic by:
sudo synaptic
Then search for the package you have installed, mariadb, and mark it for complete removal and press apply.
And these commands to install mysql-server
sudo apt-get update
sudo apt-get install mysql-server
It's quite easy to install mysql on Ubuntu.
sudo apt-get update
sudo apt-get install mysql-server
You'll be asked to create a new password for root user. Set a good password and you're ready to go.
You can also follow this youtube videos for installation and basic understanding for Mysql
sudo apt-get update
sudo apt-get install mysql-server -y
if setup password
sudo mysql_secure_installation
if set new user
sudo mysql
>CREATE USER 'username'#'%' IDENTIFIED BY 'password';
>FLUSH PRIVILEGES;
>exit
sudo systemctl restart mysql
Related
How do I uninstall MySQL in WSL?
I have version 5.7.4 installed. After reading over the changes for upgrading to the latest 5.7.x version so I could upgrade to 8.0 (there's a minimum requirement of 5.7.9 to upgrade to 8.0), I figured it would be easier to just uninstall MySQL and start over (I have nothing worth saving from playing around with it previously).
I tried running the following commands (as per this post and this one) and got the following responses:
$ sudo apt remove mysql mysql-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package mysql
$ sudo apt-get remove --purge *mysql*
zsh: no matches found: *mysql*
$ sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
zsh: no matches found: mysql-server-core-*
After running those, I'm still able to start and stop my server with the following commands (note that these are not necessarily the usual systemd commands because I'm in WSL2):
sudo /etc/init.d/mysql start
mysqladmin -u root -p shutdown
Unsure if this is relevant, but even when the server is running I'm not seeing the socket when I enter sudo find / -type s as suggested by this post.
I'm wondering it'd be okay to just delete what files I can find manually, but that seems like a bad idea
/var/lib/mysql/
/usr/share/mysql/
/usr/lib/mysql/
The problem was using zsh as a shell. I successfully removed MySQL with sudo apt-get remove --purge '*mysql*'
i have to install mysql-server for my project. but while i install with sudo apt install mysql-server it say's E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied) and E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?. i'd try to search the solving method but is has no change. thanks for any help
(edit)
and also i get this error The following packages have unmet dependencies: mysql-server-core-8.0 : Depends: libprotobuf-lite23 (>= 3.12.4) but it is not installable
The error indicates that another process is updating on your Linux machine.
You can check what processes are locking the file by running:
sudo lsof /var/lib/dpkg/lock-frontend
and kill the PID indicated by the command. If no processes are indicated by the command above, the easiest and fastest way to solve the issue is by rebooting your machine.
After the reboot rerun the command:
sudo apt install mysql-server
If the error persists, delete the lock-frontend file and reshot the command above.
Maybe you have some active apt process already?
check it:
ps aux | grep -I apt
then
sudo kill 'busy process id'
or you can kill all apt processes:
sudo killall apt apt-get
and try install MySQL again
In other case you have a locked file, just check it:
sudo lsof /var/lib/dpkg/lock-frontend
then you try to remove lock
sudo rm /var/lib/dpkg/lock-frontend
and reconfigure dpkg
sudo dpkg --configure -a
sudo apt update
I had installed MySQL in my Ubuntu OS PC. But during the config setup, I had mistakenly set Disallow root login to Y. The MySQL Workbench was not able to connect. I accessed the config file from the terminal prompt:
sudo nano /etc/mysql/mysql.conf.d/mysql.cnf
I noticed that it did not have any config. It only had the following lines:
#The MySQL client configuration file
#Refer to https://dev.mysql.com/doc/refman/en/mysql-command-options.html
[mysql]
I entered the line
bind_address = 0.0.0.0
password = mypassword
But still unable to connect MySQL Workbench. From the terminal, I was now unable to login to MySQL
I tried to uninstall MySQL and reinstall it with the following commands:
sudo apt-get remove --purge mysql*
sudo apt-get purge mysql*
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get remove dbconfig-mysql
sudo apt-get dist-upgrade
sudo apt-get install mysql-server
The last command did not proceed with the configuration. I had hoped that I will be able to set the Disallow root login to Y.
How do I uninstall/ reinstall MySQL and have MySQL Workbench connect to it.
Here's how I solved my problem First I uninstalled MySQL (again). Next, I decided to install XAMMP. I followed the how-to steps in one online resource. I launched the XAMPP and was able to connect to localhost/phpmyadmin. I was able to create a database and table, and add a record
This error is being shown whenever I want to install any software via command line.
Even if i try to install softwares which I know are present at the source from where I am downloading.
Below is the full error message i am getting :
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package mysql-server is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'mysql-server' has no installation candidate
It worked for me.
If you have followed all the previous steps successfully and after running sudo apt-get install mysql-server you are getting an error then try this
sudo apt-get install mariadb-server
I experienced this issue when trying to install MySQL Server on Debian 10.
Here's how I fixed it:
The issue is caused by the MySQL server apt repository not being included in your system's software repository list. In Debian 10 for example, MariaDB, a community fork of the MySQL project, is packaged as the default MySQL variant.
So to fix this first, add the MySQL server apt repository to your system's software repository list. Follow these steps:
Go to the download page for the MySQL APT repository at:
https://dev.mysql.com/downloads/repo/apt/
Select and download the release package for your Linux distribution. You can use:
sudo wget https://the-download-link
In my case it was:
sudo wget https://dev.mysql.com/get/mysql-apt-config_0.8.15-1_all.deb
Install the downloaded release package with the following command, replacing version-specific-package-name with the name of the downloaded package (preceded by its path, if you are not running the command inside the folder where the package is):
sudo dpkg -i version-specific-package-name.deb
In my case it was:
sudo dpkg -i mysql-apt-config_0.8.15-1_all.deb
Note: dpkg is used to install, remove, and inspect .deb software packages. The -i flag indicates that we’d like to install from the specified file.
During the installation, you’ll be presented with a configuration screen where you can specify which version of MySQL you’d prefer, along with an option to install repositories for other MySQL-related tools. The defaults will add the repository information for the latest stable version of MySQL and nothing else. This is what we want, so use the down arrow to navigate to the Ok menu option and hit ENTER.
You'll also be asked to select a repository to add. Choose 'debian buster' which has the package 'mysql-server' in it. After the adding this repository you can update the repository and use the below command to install MySQL.
sudo apt-get install mysql-server
The package will now finish adding the repository. Refresh your apt package cache to make the new software packages available:
sudo apt update
Note: If you ever need to update the configuration of these repositories, just run sudo dpkg-reconfigure mysql-apt-config, select new options, and then sudo apt-get update to refresh your package cache.
Install MySQL by the following command:
sudo apt-get install mysql-server mysql-client libmysqlclient-dev
Note: This installs the package for the MySQL server, as well as the packages for the client and for the database common files. During the installation, you are asked to supply a password for the root user for your MySQL installation.
The MySQL server is started automatically after installation. You can check the status of the MySQLserver with the following command:
sudo service mysql status
Stop the MySQL server with the following command:
sudo service mysql stop
To restart the MySQL server, use the following command:
sudo service mysql start
MySQL creates a default user called root. You can change the password to any password of your choice by logging in to MySQL console using socket authentication:
sudo mysql -u root
Then run the command below to change the password
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY 'your-preferred-password';
Reference:
A Quick Guide to Using the MySQL APT Repository
How To Install the Latest MySQL on Debian 10
That's all.
I hope this helps
You can install mysql by
sudo apt install default-mysql-server
--------
sudo service mysql status
● mariadb.service - MariaDB 10.3.31 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-09 13:19:33 +08; 33s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Main PID: 18537 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 4915)
Memory: 73.1M
CGroup: /system.slice/mariadb.service
└─18537 /usr/sbin/mysqld
run:
apt install default-mysql-server
which installs MariaDB unfortunately, but still responds to service mysql status
Most likely you are running on ubuntu. It is important to run apt-get update first.
Because doing this:-
sudo apt-get remove --purge zoneminder
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo rm -rf /var/lib/mysql
sudo apt-get remove --purge apache2*
sudo apt-get clean
sudo apt-get update
sudo apt-get upgrade
sudo rm -r /var/www/*
sudo rm -r /etc/apache2/*
sudo rmdir /var/www
sudo rmdir /etc/apache2
sudo rm -r /opt/zm
sudo rm /etc/apache2/conf.d/zoneminder.conf
sudo dpkg --configure -a
reboot hardware
sudo apt-get install zoneminder
produces this error:-
* Starting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up libapache2-mod-php5 (5.4.6-1ubuntu1.4) ...
Creating config file /etc/php5/apache2/php.ini with new version
* Restarting web server apache2 apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
[ OK ]
Setting up apache2 (2.2.22-6ubuntu2.3) ...
Setting up zoneminder (1.25.0-1.1ubuntu1) ...
Starting ZoneMinder: Can't open config file '/opt/zm/etc/zm.conf': No such file or directory at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder/Config.pm line 100.
Compilation failed in require at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/ZoneMinder.pm line 33.
Compilation failed in require at /usr/bin/zmpkg.pl line 37.
BEGIN failed--compilation aborted at /usr/bin/zmpkg.pl line 37.
failure
invoke-rc.d: initscript zoneminder, action "start" failed.
dpkg: error processing zoneminder (--configure):
subprocess installed post-installation script returned error exit status 2
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Processing triggers for ureadahead ...
Errors were encountered while processing:
zoneminder
E: Sub-process /usr/bin/dpkg returned an error code (1)
Originally zoneminder installed "first time" Ok on this 32bit "mint 14" machine using just the single apt-get install zoneminder command from here:-
http://www.tuxradar.com/content/build-your-own-surveillance-zoneminder
but when I tried to upgrade a couple of days ago to version 1.26.2 by compiling manually, I messed it up.
How can I remove zoneminder completely so that the original "clean" install works again?
No need to do any of the above, from this link:-
http://pjpramod.blogspot.co.uk/2010/01/starting-zoneminder-cant-open-config.html
So I did this:-
sudo rm -r /usr/local/share/perl/5.14.2/*
and then the install completes OK - but the popups no longer work (don't open at all or open in the same window), so don't do that.
Finally I abandoned re-installing the pre-built package (1.25.0 - or was it 1.25.2?) and downloaded the 1.26.3 tar file and unpacked it and cd'ed into it...
...and ./configure was missing...
...but if you run bootstrap.sh
./bootstrap.sh
then that (and some other things) magically appear.
Then did this:
sudo ./configure --prefix=/opt/zm --with-mysql=/usr --with-ffmpeg=/usr --with-webuser=www-data --with-webgroup=www-data --disable-debug --disable-crashtrace --enable-mmap=yes --with-webdir=/var/www --with-cgidir=/usr/lib/cgi-bin ZM_SSL_LIB=openssl
and it configured OK.
then this
sudo make
followed by this:-
sudo make install
and it installed OK but when I tried to run zoneminder I got database errors so did something like this to delete zm:-
mysql -uroot -pyourPassWord
mysql > drop database zm;
mysql > quit;
and this to recreate it (I know nothing about databases, this is monkey-see, monkey-do from here):-
mysql -u root -pyourPassWord
>create database zm;
>exit
mysql -u root -pyourPassWord zm < db/zm_create.sql
mysql -u root -pyourPassWord zm
>grant select,insert,update,delete on zm.* to 'zmuser'#localhost identified by 'zmpass';
>quit
mysqladmin -u root -pyourPassWord reload
and it then worked OK (I am running zm like this:-)
sudo /etc/init.d/zm start
And while trying to figure out what link between apache and zm did (and how apache works etc) I discovered that you only need to do this:-
localhost/index.php
to bring up zoneminder, working OK, in my browser - Yee Haw! Not bad for two day's effort and one divorce.
But I could only get zmpkg.pl to work by doing this:-
sudo /opt/zm/bin/zmpkg.pl
and not this:-
sudo zmpkg.pl
Because, I learn, that that $PATH is defined "globally" for sudo and therefore my adding /opt/zm/bin in my .bashrc file had no effect so then, rather than put zmpkg.pl into /usr/local/sbin (or one of those paths in "global" $PATH) I insert a link instead like this:-
sudo ln -s /opt/zm/bin/zmpkg.pl /usr/local/sbin/zmpkg.pl
and it works! so now e.g.
sudo zmpkg.pl status
works again.
Does anyone know how all this should be done? E.g. so that
localhost/zm
works again?
Update on 20th December 2013: I just upgraded to verion 1.26.5 successfully on this mint 14 system by repeating some of the above instructions i.e.
1) Stop zoneminder.
2) Download version 1.26.5
3) Ran the ./bootstrap.sh script (as mentioned above).
4) Ran the ./configure... script (as mentioned above).
5) Ran the make (as mentioned above - but got errors)...
So I read the README and copied and pasted this from it (line 24):
root#host:~# aptitude install -y apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm subversion automake autoconf libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch;
and then did a
sudo make clean
and then repeated 4) and 5) above and it compiled OK.
6) Did the "sudo make install" OK (i.e. on top of the old version I guess).
7) Then did all the rest of the "as mentioned above" instructions to delete zm from the database (after trying to zm unsuccessfully) and re-inserted it and then it started OK via the "zmpkg.pl start" script as version 1.26.5
8) As before I then had to manually reset up all cameras and password and users and zones but at least it all worked "first time"
I would suggest that you have to uninstall all the packages which include LAMP(apache, mysql, php) and zoneminder.
use this command to remove these packages.
sudo aptitude purge <pkg-name>
Then you have to go to zoneminder manual installation directory (say /usr/src). and use command
sudo make clean
sudp updatedb
After this you can start normal install procedure.