Centos7 install MySQL on the problem: MySQL does not start properly

Source: Internet
Author: User

The first time you install MySQL on a centos problem.

The first step to encounter problems, installation Mysql-server error is not available packages.


"Workaround"
To install MySQL first

# wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm # rpm -ivh mysql-community-release-el7-5.noarch.rpm
    • 1
    • 2

Then install Mysql-server

# yum -y install mysql-server
    • 1

Then systemctl enable mysqld set up MySQL since the start of the systemctl start mysqld problem, after the operation has been stuck after the reaction, as follows

start mysqldRedirecting to /bin/systemctl start mysql.service
    • 1
    • 2

systemctl status mysqldCheck the status of the MySQL service as follows

[Email protected] sbin]# systemctl status mysqld mysqld.service-mysql Community Server loaded:loaded (/usr/lib/syst Emd/system/mysqld.service; Enabled Vendor preset:disabled) active:activating (Start-post) since a2017-05-1517:04:CST; 5min ago process:981 Execstart=/usr/bin/mysqld_safe--BASEDIR=/USR (code=exited, status=0/success) process:938 execstartpre=/usr/bin/mysql-systemd-Start pre (code=exited, status=0/success) Main PID:981 (code=exited, status=0/success); : 982 (mysql-systemd-s) CGroup:/system.slice/mysqld.service└─control├─982/bin/bash/usr/bin/mysql-systemd-Start post└─2315 Sleep1May1517:04:Localhost.localdomain systemd[1]: Starting MySQL Community Server ...May1517:04:Localhost.localdomain mysqld_safe[981]: 170515  17: 04:15 mysqld_safe Logging to  '/VAR/LO...G '. 5 month 15  17: 04:15 localhost.localdomain mysqld_safe[ 981]: 170515  17: 04:15 Mysqld_safe starting Mysqld Dae ... sqlhint: some lines were ellipsized, use-l to show in full.   
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16

Look no problem, check MySQL log finally found the problemvim /var/log/mysqld.log

2017-05-1416:40:160 [Note] BinlogEnd17051416:40:Mysqld_safe mysqldFrom PIDFile/var/run/mysqld/mysqld.pid Ended17051517:04:Mysqld_safe LoggingTo'/var/log/mysqld.log '.17051517:04:15 mysqld_safe Starting Mysqld daemon with databases from/var/lib/mysql2017-05-15 17:04:18 0 [ERROR]/usr/sbin/mysqld: Ambiguous option  '--character-set=utf8 ' (character-set-client-handshake, Character_sets_dir) 2017- 05-15  17: 04:18 0 [ERROR] Aborting   
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

It turns out that the default character encoding is set in the my.cnf file I write character-set=ut8 and the CENTOS7 version should be set todefault-character-set=utf8

After continuing to start MySQL still cannot start, check the log as follows

2017-05-1517:14:21st1195 [Warning] Buffered warning:changed limits:table_open_cache:431 (requested2000)2017-05-1517:14:21st1195 [Note] Plugin' Federated 'Is disabled./usr/sbin/mysqld:table' Mysql.plugin ' doesn' t exist2017-05-1517:14:21st1195 [ERROR] Can' tOpen the Mysql.plugin table. Please run Mysql_upgradeTo create it.2017-05-1517:14:21st1195 [Note] innodb:using AtomicsTo ref countBuffer pool Pages2017-05-1517:14:21st1195 [Note] innodb:the InnoDB Memory heapis disabled2017-05-1517:14:21st1195 [Note] Innodb:mutexesand Rw_locksUse GCC atomic builtins2017-05-1517:14:21st1195 [Note] innodb:memory barrierIsNot used2017-05-1517:14:21st1195 [Note] innodb:compressed tablesUse Zlib1.2.32017-05-1517:14:21st1195 [Note] innodb:using Linux native AIO2017-05-15 17:14:21 1195 [Note] InnoDB: not using CPU crc32 instructions2017-05-15 17:14:21 1195 [Note] innodb:initializing Span class= "Hljs-keyword" >buffer pool, size = 128.0m170515 17:04:18 mysqld_safe mysqld from PID file/var/run/mysqld/mysqld.pid ended        
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14

Note Error
Can ' t open the Mysql.plugin table. Please run Mysql_upgrade to create it.
"Workaround"
Use the Add parameter –datadir when you run the Initialize permission table
Mysql_install_db–user=mysql–datadir=/usr/local/mysql/var
Baidu after

When you finish installing MySQL server, you typically execute this script to initialize the database. Running this script initializes the MySQL data directory and creates those system tables.
The system table space is also initialized and associated with the InnoDB table and data structure.
For more information, click here to view

After the boot service is still stuck, look back at the prompt after executing the command

Alternatively you can run:  /usr/bin/mysql_secure_installation
    • 1
    • 2

The MySQL Security Configuration Wizard is executed mysql_secure_installation
After installing Mysql-server, you will be prompted to run mysql_secure_installation. Running Mysql_secure_installation will perform several settings:
A) set a password for the root user
b) Delete Anonymous account
c) Remove the root user from remote login
d) Delete the test library and access to the test library
e) Refresh the authorization form for the changes to take effect
After execution systemctl restart mysqld , the command executes normally.

Log on to MySQL as normal startup

Centos7 install MySQL on the problem: MySQL does not start properly

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.