In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Currently, there is no mysql in Centos7's yum source, so you can install it directly. I used MariaDB instead.
Then if we want to install the MySQL database, we can use the following method # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm# rpm-ivh mysql-community-release-el7-5.noarch.rpm# yum install mysql-community-server
Restart the mysql service after successful installation
# systemctl start mysqld.service
When mysql is installed for the first time, the root account has no password.
Set the password:
# mysql-uroot
Mysql > set password for 'root'@'localhost' = password (' mypasswd')
Mysql > exit
PS: if you are developing and learning on a personal computer, you don't have to set a password
Login without password: mysql-uroot
Login with password: mysql-uroot-p your password
After successful installation, there are several important directories: database directory
/ var/lib/mysql/
Configuration file
/ usr/share/mysql (mysql.server commands and configuration files)
Related command
/ usr/bin (mysqladmin mysqldump, etc.)
Startup script
/ etc/rc.d/init.d/ (directory of startup script file mysql)
- -
1. Download MySQL Yum Repository
Wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
2. Add MySQL Yum Repository
Rpm-ivh mysql-community-release-el7-5.noarch.rpm
3. Verify whether the addition is successful.
Yum repolist enabled | grep "mysql.*-community.*"
4. Select the MySQL version to be enabled
Check the MySQL version and execute yum repolist all | grep mysql
You can see that version 5.5 and 5.7 is disabled by default, because the latest stable version is 5.6.
You can start some versions with statements similar to the following
Yum-config-manager-disable mysql56-community
Yum-config-manager-enable mysql57-community-dmr
Or by modifying the / etc/yum.repos.d/mysql-community.repo file
# Enable to use MySQL 5.6
[mysql56-community]
Name=MySQL 5.6 Community Server
Baseurl= http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
Enabled=1
Gpgcheck=1
Gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Where enabled=0 is disabled and enabled=1 is enabled.
Note: only one version can be enabled at any time.
5. Install MySQL through Yum
Yum install mysql-community-server
6. MySQL security settings (set password)
Mysql_secure_installation
7. Remote access settings
Create a normal user sa with a password of some_pass
CREATE USER 'sa'@'%' IDENTIFIED BY' some_pass'
This user is granted remote access to SELECT,INSERT,UPDATE,DELETE, which is typically used to provide system access to the implementation
GRANT SELECT,INSERT,UPDATE,DELETE ON *. * TO 'sa'@'%'
Create an administrator user admin account with a password of some_pass
CREATE USER 'admin'@'%' IDENTIFIED BY' some_pass'
Grant this user all remote access rights. This user is mainly used to manage the entire database, backup, restore and other operations.
GRANT ALL ON *. * TO 'admin'@'%'
Make the authorization effective immediately
Flush privileges
8. Set the character set
In general, in order to support Chinese, we should set the character set to UTF-8 and execute the following command to view the current MySQL character set
SHOW VARIABLES LIKE 'character%'
Modify the / etc/my.cnf file to add settings for the character set
[mysqld]
Character_set_server = utf8
[mysql]
Default-character-set = utf8
Restart MySQL and you can see that the character set has been modified
9. Backup, restore
Backup
Mysqldump-- socket=/home/data/mysql/mysql.sock-- single-transaction=TRUE-u root-p emsc > emsc.sql
Reduction
Mysql-- socket=/home/data/mysql/mysql.sock-u root-p emsc < emsc.sql
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.