Installation in mysql Linux

Keywords: MySQL RPM MariaDB Linux

Linux version

Linux localhost.localdomain 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux

From: http://www.cnblogs.com/xiaochaohuashengmi/archive/2011/10/18/2216087.html

Configuration of Mysql under Linux (rpm installation)

install
rmp -ivh MySQL-server-4.1.22-0.glibc23.i386.rpm --nodeps
rmp -ivh MySQL-client-4.1.22-0.glibc23.i386.rpm --nodeps
Check to see if the installation was successful
netstat -atln 
Command to see port 3306 open instructions installed successfully
Sign in
mysql [-u username] [-h host] [-p[password]] [dbname]

 

Initially no password, the mysql executable is in / usr/bin/mysql
 
Catalog
 
1. Database catalogue
   /var/lib/mysql/
2. Configuration file
/ usr/share/mysql (mysql.server command and configuration file)
3. Relevant orders
/ usr/bin (commands such as mysqladmin mysqldump)
4. Start script
/ etc/rc.d/init.d/(directory of startup script file mysql)
 
Modify login password
 
MySQL defaults to no password
usr/bin/mysqladmin -u root password 'new-password'
Format:
mysqladmin-u username-p old password new password
Start and Stop
After the installation of MySQL, start the file MySQL in the / etc/init.d directory, run the following commands when you need to start
Start up:
/etc/init.d/mysql start
Stop it:
/usr/bin/mysqladmin -u root -p shutdown

Restart:

sudo  /etc/init.d/mysql restart

 

Autostart:
See if mysql is in the autostart list / sbin/chkconfig --list
Add MySQL to the startup service group of your system / sbin/chkconfig --add mysql
Delete MySQL from the startup service group / sbin/chkconfig --del mysql
To configure
Copy / usr/share/mysql/my-medium.cnf to / etc/my.cnf, and later modify my.cnf file to modify the global settings of mysql
Set innodb_flush_log_at_trx_commit in my.cnf file to 0 to optimize

Add lower_case_table_names after [mysqld] and set it to 1 to make it case-insensitive

Setting Character Set
MySQL's default encoding is Latin1, which does not support Chinese. To support this, it is necessary to change the default encoding of the database to gbk or utf8.
1. Discontinue MySQL Service (bin/mysqladmin-u root shutdown)
2. Find my.cnf under / etc / and if not copy my-medium.cnf under the support-files directory under the installation directory of MySQL to / etc / and rename it my.cnf.
3. After opening my.cnf, add default-character-set=utf8 under [client] and [mysqld] to save and close
4. Start MySQL Service (bin/mysqld_safe &)
Query Character Set: show variables like'% set%';
 
Increase MySQL users
Format:
grant select on database. * to username@logon host identified by "password"
 
grant select,insert,update,delete on *.* to user_1@'%' Identified by '123';
grant all on *.* to user_1@'localhost' Identified by '123';
 
remote access
First:
GRANT ALL PRIVILEGES ON *.* TO xoops_root@'%' IDENTIFIED BY '654321';
Allow xoops_root users to log in to MySQL from any machine.
Second:
Edit/etc/mysql/my.cnf
  >skip-networking => # skip-networking
This allows other machines to access MySQL.

   grant all on *.* to 'root'@'ip' identified by 'password'; 

Backup and Recovery
backups
Go to the library directory, cd/val/lib/mysql
mysqldump -u root -p --opt aaa > back_aaa
recovery
mysql -u root -p ccc < back_aaa


From: https://www.cnblogs.com/xieshengsen/p/6224227.html

linux environment RPM installation MYSQL5.6

linux environment RPM installation MYSQL5.6

System Environment CentOS 7.2

1. Turn off SELinux services [SELinux is a domain-type-based mandatory access control (MAC) security system]

[root@OperationsAnalysis ~]# vim /etc/selinux/config 
···
SELINUX=disabled
···

2. Close the firewall service and disable boot-up

[root@OperationsAnalysis ~]# systemctl stop firewalld.service
[root@OperationsAnalysis ~]# systemctl disable firewalld.service

3. Close the NetworkManager service and disable boot-up (NetworManager is a program that detects and automatically connects networks)

[root@OperationsAnalysis ~]# systemctl stop NetworkManager.service
[root@OperationsAnalysis ~]# systemctl disable NetworkManager.service

4. Check whether the system has mysql installation packages installed, and if you use rpm-e to remove them

[root@OperationsAnalysis ~]# rpm -qa| grep mysql

5. Download the installation package of MySQL 5.6 and upload it to the server

[root@OperationsAnalysis mysql]# ll
total 236180
-rw-r--r-- 1 root root 20278972 Sep 22 15:41 MySQL-client-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  3529244 Sep 22 15:40 MySQL-devel-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 92246408 Sep 22 15:44 MySQL-embedded-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 61732192 Sep 22 15:42 MySQL-server-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  2101912 Sep 22 15:42 MySQL-shared-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root  2299648 Sep 22 15:40 MySQL-shared-compat-5.6.31-1.el7.x86_64.rpm
-rw-r--r-- 1 root root 59644132 Sep 22 15:40 MySQL-test-5.6.31-1.el7.x86_64.rpm

6. Installation package for mysql

[root@OperationsAnalysis mysql]# rpm -ivh MySQL-server-5.6.31-1.el7.x86_64.rpm 
[root@OperationsAnalysis mysql]# rpm -ivh MySQL-devel-5.6.31-1.el7.x86_64.rpm 
[root@OperationsAnalysis mysql]# rpm -ivh MySQL-client-5.6.31-1.el7.x86_64.rpm

7. Modify my.cnf configuration file location

[root@OperationsAnalysis ~]# cp /usr/share/mysql/my-default.cnf /etc/my.cnf

8. Modify the character set and data storage path configuration/etc/my.cnf file and set the following key values to enable a useful combination of options and UTF-8 character sets.

[root@OperationsAnalysis ~]# cat /etc/my.cnf
[mysqld]
···
innodb_file_per_table
max_connections = 4096
collation-server = utf8_general_ci
character-set-server = utf8

9. Initialize MySQL and Set Password

[root@OperationsAnalysis ~]# /usr/bin/mysql_install_db
[root@OperationsAnalysis ~]# service mysql start
[root@OperationsAnalysis ~]# cat /root/.mysql_secret
# The random password set for the root user at Mon Dec 26 20:43:34 2016 (local time): 1dwIOrYEiaPsCyTM
[root@OperationsAnalysis ~]# mysql -uroot -p1dwIOrYEiaPsCyTM
mysql> SET PASSWORD = PASSWORD('abcd1234');
Query OK, 0 rows affected (0.00 sec)

10. Set up mysql boot-up

[root@OperationsAnalysis ~]# systemctl restart mysqld.service
[root@OperationsAnalysis ~]# systemctl enable mysqld.service

11. Set mysql to allow remote login

 

12. Installation of mysql is incompatible with installation packages

[root@OperationsAnalysis mysql]# rpm -ivh MySQL-server-5.6.31-1.el7.x86_64.rpm
warning: MySQL-server-5.6.31-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
        file /usr/share/mysql/charsets/README from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/czech/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/danish/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64
        file /usr/share/mysql/dutch/errmsg.sys from install of MySQL-server-5.6.31-1.el7.x86_64 conflicts with file from package mariadb-libs-1:5.5.41-2.el7_0.x86_64

Solution to remove incompatible installation packages

[root@OperationsAnalysis mysql]# rpm -qa |grep mariadb*
mariadb-libs-5.5.41-2.el7_0.x86_64
[root@OperationsAnalysis mysql]# Rpm-e mariadb-libs-5.5.41-2.el7_0.x86_64
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
[root@OperationsAnalysis mysql]# yum remove mariadb-libs* -y



Posted by Hodo on Thu, 16 May 2019 02:10:16 -0700