How to install MySQL on CentOS

1)chekc centos中是否安装了MySQL

[[email protected] MySQL]# rpm -qa | grep mariadb

mariadb-libs-5.5.52-1.el7.x86_64

2)卸载过程

[[email protected] MySQL]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64

3)安装过程

安装顺序如下:

rpm -ivh mysql-community-common-5.7.17-1.el7.x86_64.rpm

rpm -ivh mysql-community-libs-5.7.17-1.el7.x86_64.rpm

rpm -ivh mysql-community-client-5.7.17-1.el7.x86_64.rpm

rpm -ivh mysql-community-devel-5.7.17-1.el7.x86_64.rpm

rpm -ivh net-tools-2.0-0.17.20131004git.el7.x86_64.rpm

rpm -ivh mysql-community-server-5.7.17-1.el7.x86_64.rpm

4) 启动mysql

[[email protected] MySQL]# systemctl start mysqld

查看启动情况

[[email protected] MySQL]# ps -aux|grep -i mysql

mysql     2543  0.8 23.7 1119216 179968 ?      Sl   20:44   0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid

root      2586  0.0  0.1 112648   976 pts/0    S+   20:45   0:00 grep --color=auto -i mysql

或者

[[email protected] MySQL]# netstat -na|grep -i 3306

tcp6       0      0 :::3306                 :::*                    LISTEN

unix  2      [ ACC ]     STREAM     LISTENING     13306    /var/run/dbus/system_bus_socket

5)使用root登陆MySQL

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

Enter password:

ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)

[[email protected] sbin]# whereis mysql

mysql: /usr/bin/mysql /usr/lib64/mysql /usr/include/mysql /usr/share/mysql /usr/share/man/man1/mysql.1.gz

可以查看mysql的安装目录是/usr/bin

查看log

[[email protected] sbin]# cat  /var/log/mysqld.log

2017-01-10T12:43:28.664990Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-01-10T12:43:32.450615Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-01-10T12:43:35.748969Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-01-10T12:43:36.574416Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 6779b126-d732-11e6-b856-0800275f50a5.

2017-01-10T12:43:36.677747Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.

2017-01-10T12:43:36.678899Z 1 [Note] A temporary password is generated for [email protected]: +x/GZM(Hf9=f

2017-01-10T12:44:38.169331Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-01-10T12:44:38.172923Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.17) starting as process 2543 ...

2017-01-10T12:44:38.179188Z 0 [Note] InnoDB: PUNCH HOLE support available

2017-01-10T12:44:38.179226Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins

2017-01-10T12:44:38.179231Z 0 [Note] InnoDB: Uses event mutexes

2017-01-10T12:44:38.179235Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier

2017-01-10T12:44:38.179239Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3

2017-01-10T12:44:38.179245Z 0 [Note] InnoDB: Using Linux native AIO

2017-01-10T12:44:38.179462Z 0 [Note] InnoDB: Number of pools: 1

2017-01-10T12:44:38.179555Z 0 [Note] InnoDB: Using CPU crc32 instructions

2017-01-10T12:44:38.181302Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M

2017-01-10T12:44:38.188077Z 0 [Note] InnoDB: Completed initialization of buffer pool

2017-01-10T12:44:38.191550Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().

2017-01-10T12:44:38.203389Z 0 [Note] InnoDB: Highest supported file format is Barracuda.

2017-01-10T12:44:38.287616Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables

2017-01-10T12:44:38.287803Z 0 [Note] InnoDB: Setting file ‘./ibtmp1‘ size to 12 MB. Physically writing the file full; Please wait ...

2017-01-10T12:44:38.860560Z 0 [Note] InnoDB: File ‘./ibtmp1‘ size is now 12 MB.

2017-01-10T12:44:38.865801Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.

2017-01-10T12:44:38.865872Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.

2017-01-10T12:44:38.867349Z 0 [Note] InnoDB: Waiting for purge to start

2017-01-10T12:44:38.920092Z 0 [Note] InnoDB: 5.7.17 started; log sequence number 2536132

2017-01-10T12:44:38.920917Z 0 [Note] Plugin ‘FEDERATED‘ is disabled.

2017-01-10T12:44:38.932784Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool

2017-01-10T12:44:38.935813Z 0 [Note] InnoDB: Buffer pool(s) load completed at 170110 20:44:38

2017-01-10T12:44:39.061606Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.

2017-01-10T12:44:39.062541Z 0 [Warning] CA certificate ca.pem is self signed.

2017-01-10T12:44:39.109111Z 0 [Note] Server hostname (bind-address): ‘*‘; port: 3306

2017-01-10T12:44:39.109573Z 0 [Note] IPv6 is available.

2017-01-10T12:44:39.109605Z 0 [Note]   - ‘::‘ resolves to ‘::‘;

2017-01-10T12:44:39.109643Z 0 [Note] Server socket created on IP: ‘::‘.

2017-01-10T12:44:39.320841Z 0 [Note] Event Scheduler: Loaded 0 events

2017-01-10T12:44:39.321028Z 0 [Note] Executing ‘SELECT * FROM INFORMATION_SCHEMA.TABLES;‘ to get a list of tables using the deprecated partition engine. You may use the startup option ‘--disable-partition-engine-check‘ to skip this check.

2017-01-10T12:44:39.321045Z 0 [Note] Beginning of list of non-natively partitioned tables

2017-01-10T12:44:39.349166Z 0 [Note] End of list of non-natively partitioned tables

2017-01-10T12:44:39.349489Z 0 [Note] /usr/sbin/mysqld: ready for connections.

Version: ‘5.7.17‘  socket: ‘/var/lib/mysql/mysql.sock‘  port: 3306  MySQL Community Server (GPL)

2017-01-10T12:47:14.947473Z 3 [Note] Access denied for user ‘root‘@‘localhost‘ (using password: NO)

6) mysql设置

set global validate_password_policy=0

alter user ‘root‘@‘localhost‘ identified by ‘passw0rd‘;

create database hive;

create user ‘hive‘ identified by ‘passw0rd‘;

grant all privileges on hive.* to ‘hive‘@‘%‘;

时间: 2024-10-25 20:10:17

How to install MySQL on CentOS的相关文章

How to Install MySQL on CentOS 7

How to Install MySQL on CentOS 7 Updated Thursday, August 27th, 2015 by Linode Use promo code DOCS10 for $10 credit on a new account. Try this Guide Contribute on GitHub View Project | View File | Edit File MySQL is a popular database management syst

install mysql in centos and change passoword

Install mysql Installing MySQL wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm md5sum mysql57-community-release-el7-9.noarch.rpm rpm -ivh mysql57-community-release-el7-9.noarch.rpm yum install mysql-server Starting MySQL sys

Install MySQL 5.7 on Fedora 25/24, CentOS/RHEL 7.3/6.8/5.11

1. Change root user Bash su - ## OR ## sudo -i 2. Install MySQL YUM repository Fedora Bash ## Fedora 25 ## dnf install https://dev.mysql.com/get/mysql57-community-release-fc25-9.noarch.rpm ## Fedora 24 ## dnf install https://dev.mysql.com/get/mysql57

Install Apache, PHP And MySQL On CentOS 7 (LAMP)

原文 Install Apache, PHP And MySQL On CentOS 7 (LAMP) This tutorial shows how you can install an Apache2 webserver on a CentOS 7.0 server with PHP5 support (mod_php) and MySQL support. LAMP is short for Linux, Apache,MySQL, PHP. 1 Preliminary Note In t

How to install LEMP on centos 6 ( Nginx, PHP, Mysql )

Nginx installation Step 1 ? Install Nginx repository package . you could find the latest package here ( Nginx linux packages ) [[email protected] ~]# rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm[

How to Install MySQL 5.6 from Official Yum Reposit

Tags: MySQL Distribution: CentOS Submitted by: Morgan TockerMySQL Community Manager @ Oracle Introduction In October 2013, the MySQL development team officially launched support for yum repositories. This means that you can now ensure that you have t

yum mysql on centos 7

参考:https://www.linode.com/docs/databases/mysql/how-to-install-mysql-on-centos-7 centos 7上没有办法使用yum install mysql等命令了: wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm yum updat

mysql在centos上的编译安装

环境:centos6.5  mysql-5.6.17.tar.gz wget http://cdn.mysql.com/Downloads/MySQL-5.6/mysql-5.6.17.tar.gz yum install -y gcc gcc-c++ gcc-c++.x86_64 bison.x86_64 libaio.x86_64 cmake.x86_64 ncurses-devel.x86_64 后面根据官方文档: MySQL 5.6 Manual 2.8.2 Installing MyS

How to install Zabbix on CENTOS 7

when you have installed zabbix , it is important of changing password. How to install Zabbix on CENTOS 7 Setup 1 INSTALL Create the repos of Zabbix rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rp