Home>

The database in the previous Linux system was mostly mysql, but since it was acquired by sun,There is no need to integrate in centos open source linux systems,Then you need to install it yourself if i want to use it,First of all centos7 does not support mysql, because you know how to charge,So mariadb is integrated internally, and if you install mysql, it will conflict with mariadb files.So you need to uninstall mariadb first, here are the steps to uninstall mariadb and install mysql.

#List all installed rpm packages

rpm -qa | grep mariadb

#Uninstall

rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64

Error:Dependency detection failed:

libmysqlclient.so.18 () (64bit) is required by (installed) postfix-2:2.10.1-6.el7.x86_64

libmysqlclient.so.18 (libmysqlclient_18) (64bit) is required by (installed) postfix-2:2.10.1-6.el7.x86_64

#Forced uninstall,Because there is no --nodeps

rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64

#Install the rpm package of mysql5.5.39

rpm -ivh /home/liwei/mysql-server-5.5.39-2.el6.x86_64.rpm

rpm -ivh /home/liwei/mysql-client-5.5.39-2.el6.x86_64.rpm

#Copy the configuration file

cp /usr/share/mysql/my-medium.cnf /etc/my.cnf, renamed my.cnf as the mysql configuration file

#Modify the configuration file of the response

vim /etc/my.cnf

#Copy mysql data to the specified directory

mv/var/lib/mysql/home/mysql/data /

Also note the owner and permissions of the directory.

After mysql startup:error! the server quit without updating pid file error

1. Insufficient permissions:chown -r mysql:mysql/home/mysql/data "" chmod -r 755/home/mysql/data

2. Selinux problem with centos7:Open/etc/selinux/config and change selinux=enforcing to selinux

Centos7 correct command to install mariadb

I use linode's centos7 system, install mysql and find that the default is mariadb.

However, the basic installation method searched by Linode's official website or searched by Baidu cannot be successfully installed.

Always prompt this sentence:

error 2002 (hy000):can "t connect to local mysql server through socket" /var/lib/mysql/mysql.sock "(2)

Finally googled install mariadb on centos 7 to get the key step of the installation.

The installation is now successful.Here is a note of the entire installation process:

mysql:[[email protected] ~] #yum -y install mariadb *

loaded plugins:fastestmirror

loading mirror speeds from cached hostfile

* base:mirrors.linode.com

* extras:mirrors.linode.com

* updates:mirrors.linode.com

resolving dependencies

->Running transaction check

--->package mariadb.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-bench.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-devel.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-embedded.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-embedded-devel.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-libs.x86_64 1:5.5.37-1.el7_0 will be installed

--->package mariadb-server.x86_64 1:5.5.37-1.el7_0 will be installed

->Processing dependency:perl-dbd-mysql for package:1:mariadb-server-5.5.37-1.el7_0.x86_64

--->package mariadb-test.x86_64 1:5.5.37-1.el7_0 will be installed

->Running transaction check

--->package perl-dbd-mysql.x86_64 0:4.023-5.el7 will be installed

->Finished dependency resolution

dependencies resolved

======================================================= ======================================================= ======

package arch version repository size

======================================================= ======================================================= ======

installing:

mariadb x86_64 1:5.5.37-1.el7_0 updates 8.9 m

mariadb-bench x86_64 1:5.5.37-1.el7_0 updates 385 k

mariadb-devel x86_64 1:5.5.37-1.el7_0 updates 744 k

mariadb-embedded x86_64 1:5.5.37-1.el7_0 updates 3.6 m

mariadb-embedded-devel x86_64 1:5.5.37-1.el7_0 updates 7.4 m

mariadb-libs x86_64 1:5.5.37-1.el7_0 updates 752 k

mariadb-server x86_64 1:5.5.37-1.el7_0 updates 11 m

mariadb-test x86_64 1:5.5.37-1.el7_0 updates 7.9 m

installing for dependencies:

perl-dbd-mysql x86_64 4.023-5.el7 base 140 k

transaction summary

======================================================= ======================================================= ======

install 8 packages (+1 dependent package)

total download size:40 m

installed size:279 m

downloading packages:

(1/9):mariadb-bench-5.5.37-1.el7_0.x86_64.rpm | 385 kb 00:00:00

(2/9):mariadb-devel-5.5.37-1.el7_0.x86_64.rpm | 744 kb 00:00:00

(3/9):mariadb-embedded-5.5.37-1.el7_0.x86_64.rpm | 3.6 mb 00:00:00

(4/9):mariadb-5.5.37-1.el7_0.x86_64.rpm | 8.9 mb 00:00:00

(5/9):mariadb-libs-5.5.37-1.el7_0.x86_64.rpm | 752 kb 00:00:00

(6/9):mariadb-server-5.5.37-1.el7_0.x86_64.rpm | 11 mb 00:00:00

(7/9):mariadb-embedded-devel-5.5.37-1.el7_0.x86_64.rpm | 7.4 mb 00:00:00

(8/9):mariadb-test-5.5.37-1.el7_0.x86_64.rpm | 7.9 mb 00:00:00

(9/9):perl-dbd-mysql-4.023-5.el7.x86_64.rpm | 140 kb 00:00:00

-------------------------------------------------- -------------------------------------------------- ------

total 36 mb/s | 40 mb 00:00:01

running transaction check

running transaction test

transaction test succeeded

running transaction

installing:1:mariadb-libs-5.5.37-1.el7_0.x86_64 1/9

installing:1:mariadb-5.5.37-1.el7_0.x86_64 2/9

installing:perl-dbd-mysql-4.023-5.el7.x86_64 3/9

installing:1:mariadb-server-5.5.37-1.el7_0.x86_64 4/9

installing:1:mariadb-devel-5.5.37-1.el7_0.x86_64 5/9

installing:1:mariadb-embedded-5.5.37-1.el7_0.x86_64 6/9

installing:1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_64 7/9

installing:1:mariadb-test-5.5.37-1.el7_0.x86_64 8/9

installing:1:mariadb-bench-5.5.37-1.el7_0.x86_64 9/9

verifying:1:mariadb-test-5.5.37-1.el7_0.x86_64 1/9

verifying:1:mariadb-embedded-devel-5.5.37-1.el7_0.x86_64 2/9

verifying:1:mariadb-embedded-5.5.37-1.el7_0.x86_64 3/9

verifying:1:mariadb-libs-5.5.37-1.el7_0.x86_64 4/9

verifying:1:mariadb-bench-5.5.37-1.el7_0.x86_64 5/9

verifying:1:mariadb-5.5.37-1.el7_0.x86_64 6/9

verifying:1:mariadb-server-5.5.37-1.el7_0.x86_64 7/9

verifying:perl-dbd-mysql-4.023-5.el7.x86_64 8/9

verifying:1:mariadb-devel-5.5.37-1.el7_0.x86_64 9/9

installed:

mariadb.x86_64 1:5.5.37-1.el7_0 mariadb-bench.x86_64 1:5.5.37-1.el7_0

mariadb-devel.x86_64 1:5.5.37-1.el7_0 mariadb-embedded.x86_64 1:5.5.37-1.el7_0

mariadb-embedded-devel.x86_64 1:5.5.37-1.el7_0 mariadb-libs.x86_64 1:5.5.37-1.el7_0

mariadb-server.x86_64 1:5.5.37-1.el7_0 mariadb-test.x86_64 1:5.5.37-1.el7_0

dependency installed:

perl-dbd-mysql.x86_64 0:4.023-5.el7

complete!

[[email protected] ~] #systemctl start mariadb.service

[[email protected] ~] #systemctl enable mariadb.service

ln -s "/usr/lib/systemd/system/mariadb.service" "/etc/systemd/system/multi-user.target.wants/mariadb.servi

ce "

[[email protected] ~] #mysql

welcome to the mariadb monitor. commands end with;or \ g.

your mariadb connection id is 2

server version:5.5.37-mariadb mariadb server

copyright (c) 2000, 2014, oracle, monty program ab and others.

type "help;" or "\ h" for help. type "\ c" to clear the current input statement.

mariadb [(none)]>logout

->Exit

->

->;

error 1064 (42000):you have an error in your sql syntax;check the manual that corresponds to your mariad

b server version for the right syntax to use near "logout

exit "at line 1

mariadb [(none)]>exit

bye

[[email protected] ~] #systemctl enable mariadb.service

[[email protected] ~] #mysql

welcome to the mariadb monitor. commands end with;or \ g.

your mariadb connection id is 3

server version:5.5.37-mariadb mariadb server

copyright (c) 2000, 2014, oracle, monty program ab and others.

type "help;" or "\ h" for help. type "\ c" to clear the current input statement.

mariadb [(none)]>show databases;

+ -------------------- +

database |

+ -------------------- +

| information_schema |

| mysql |

| performance_schema |

| test |

+ -------------------- +

4 rows in set (0.00 sec)

mariadb [(none)]>use test

database changed

mariadb [test]>show tables;

empty set (0.00 sec)

mariadb [test]>exit

bye

[[email protected] ~] #mysql_secure_installation

/usr/bin/mysql_secure_installation:line 379:find_mysql_client:command not found

note:running all parts of this script is recommended for all mariadb

servers in production use! please read each step carefully!

in order to log into mariadb to secure it, we "ll need the current

password for the root user. if you "ve just installed mariadb, and

you haven "t set the root password yet, the password will be blank,

so you should just press enter here.

enter current password for root (enter for none):

ok, successfully used password, moving on ...

setting the root password ensures that nobody can log into the mariadb

root user without the proper authorisation.

set root password?[y/n] y

new password:

re-enter new password:

password updated successfully!

reloading privilege tables ..

... success!

by default, a mariadb installation has an anonymous user, allowing anyone

to log into mariadb without having to have a user account created for

them. This is intended only for testing, and to make the installation

go a bit smoother. you should remove them before moving into a

production environment.

remove anonymous users?[y/n] y

... success!

normally, root should only be allowed to connect from "localhost". this

Ensure that someone cannot guess at the root password from the network.

disallow root login remotely?[y/n] y

... success!

by default, mariadb comes with a database named "test" that anyone can

access. this is also intended only for testing, and should be removed

before moving into a production environment.

remove test database and access to it?[y/n] y

-dropping test database ...

... success!

-removing privileges on test database ...

... success!

reloading the privilege tables will ensure that all changes made so far

will take effect immediately.

reload privilege tables now?[y/n] y

... success!

cleaning up ...

all done! if you "ve completed all of the above steps, your mariadb

installation should now be secure.

[[email protected] ~] #mysql -uroot -p

enter password:

welcome to the mariadb monitor. commands end with;or \ g.

your mariadb connection id is 15

server version:5.5.37-mariadb mariadb server

copyright (c) 2000, 2014, oracle, monty program ab and others.

type "help;" or "\ h" for help. type "\ c" to clear the current input statement.

mariadb [(none)]>show databases;

+ -------------------- +

database |

+ -------------------- +

| information_schema |

| mysql |

| performance_schema |

| zbphp.com |

+ -------------------- +

4 rows in set (0.00 sec)

mariadb [(none)]>

  • Previous Steps to install mysql server in CentOS 7
  • Next Detailed ASPNET forms authentication