In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Reference: http://www.centoscn.com/mysql/2016/0315/6844.html
Check whether mysql is installed: # rpm-qa | grep-I mysql / / this command will check whether the mysql database has been installed on the operating system-I ignore case and uninstall the original mysql: # rpm-e mysql / / normal delete mode # rpm-e-- nodeps mysql / / strong delete mode, if you delete it using the above command If you are prompted to have other dependent files, you can use this command to delete them and view the mysql version provided by yum: # yum list | grep-I mysql. Then we can install mysql mysql-server mysql-devel by entering the yum install-y mysql-server mysql mysql-devel command (Note: when we install mysql, we do not install the mysql client is equivalent to installing the mysql database. We also need to install the mysql-server server) # yum install-y mysql-server mysql mysql-deve start or stop service # service mysqld stop # service mysqld restart # systemctl enable mysqld # set boot # / usr/bin/mysqladmin-u root password' new-password' / / set the password for the root account # mysql > grant all privileges on *. * to 'root'@' % 'identified by' 123456' with grant option # flush privileges Firewall-cmd (recommended) executes firewall-cmd-- permanent-- zone=public-- add-port=3306/tcp firewall-cmd-- permanent-- zone=public-- add-port=3306/udp so that the corresponding port is opened. Execute firewall-cmd-- reload to make the latest firewall setting rules take effect. Configuration file: # cp / usr/share/mysql/my-default.cnf / etc/my.cnf add [mysqld] character_set_server=utf8 init_connect='SET NAMES utf8' View mysql installed version: mysql-version View enable Port: netstat-ntpl | grep 3306 Note: if it is a rpm download package rpm-ivh example.rpm install example.rpm Package and display the information of the files being installed and the installation progress during the installation process
Pit one: Access denied for user 'root'@'localhost' (using password: NO)
Resolution steps:
1. After stopping the mysql service, service mysql stop, secure startup: mysql_safe-- skip-grant-tables
170310 18:02:36 mysqld_safe Logging to'/ var/lib/mysql/localhost.localdomain.err'.
170310 18:02:36 mysqld_safe Starting mysqld daemon with databases from / var/lib/mysql
2, mysql-u root
Mysql > use mysql
Mysql > update user set password=PASSWORD ("123456") where User='root'
Mysql > grant all privileges on *. * to 'root'@'%' identified by' 123456 'with grant option
Flush privileges
3, service mysql stop; service mysql start
4MySQL-uroot-p; enter the password to log in to ok
5, firewall-cmd-- add-port=3306/tcp-- permanent # Open port 3306
Pit 2: it was found that the CentOS 7 version removed MySQL database software from the default program list and replaced it with mariadb.
There are two solutions:
1. Method 1: install mariadb
MariaDB database management system is a branch of MySQL, which is mainly maintained by the open source community and licensed by GPL. One of the reasons for developing this branch is that after Oracle acquired MySQL, there is a potential risk of shutting down MySQL, so the community uses a branching approach to avoid this risk. The goal of MariaDB is to be fully compatible with MySQL, including API and the command line, making it an easy replacement for MySQL.
Install mariadb, size 59m.
[root@yl-web yl] # yum install mariadb-server mariadb
The relevant commands for the mariadb database are:
Systemctl start mariadb # launch MariaDB
Systemctl stop mariadb # stop MariaDB
Systemctl restart mariadb # restart MariaDB
Systemctl enable mariadb # set boot up
So start the database first.
[root@yl-web yl] # systemctl start mariadb
Then you can use mysql normally.
Method 2: download and install mysql-server on the official website
# wget # rpm-ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server
Restart the mysql service after successful installation.
# service mysqld restart
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.