Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use yum to install MySQL in Linux system

Shulou Source: shulou.com Published: 2022-06-02 00:51:26 10月02日 Update

This article introduces the relevant knowledge of "how to use yum to install MySQL in Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Environment: Centos 6.5

Linux uses the yum command to install mysql

\ 1. First check if the system is equipped with mysql

[root@localhost ~] # yum list installed mysql* [root@localhost ~] # rpm-qa | grep mysql*\ 2. Check to see if there is a package installed

[root@localhost] # yum list mysql*\ 3. Install the mysql client

[root@localhost] yum install mysql\ 4. Install the mysql server

[root@localhost] # yum install mysql-server [root@localhost ~] # yum install mysql-devel\ 5. Add the default character set to the / etc/my.cnf file

[root@localhost ~] # vim / etc/my.cnf

\ 6. Start or shut down the mysql service

[root@localhost ~] # service mysqld start-start mysql or / etc/init.d/mysqld start (turn off mysql # service mysql stop)\ 6. Set the boot to start the mysql service

[root@localhost] # chkconfig-- add mysqld

\ 7. Create a root user password of 123456

Mysqladmin-u root password 123456

[root@localhost] # mysqladmin-u root password 123456\ 8. Connect mysql

[root@localhost ~] # mysql-u root-p-enter password 123456

\ 9. Set remote access permissions

Mysql > use mysql mysql > GRANT ALL PRIVILEGES ON *. * TO 'admin'@'%'IDENTIFIED BY' admin' WITH GRANT OPTION;-the first admin is the user name, the second admin is the password,% indicates that all computers can be linked to mysql > flush privileges;-the setting takes effect immediately

Mysql > SELECT DISTINCT CONCAT ('User:''',user,'''@''',host,''';') AS query FROM mysql.user; mysql > exit -- exit mysql service [root@localhost ~] # vi / etc/my.cnf [mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock user=mysql default-character-set=utf8 # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # device address bind-address=0.0.0.0 # set device address [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld .pid [root@localhost ~] # service mysqld start-- restart the mysql service [root@localhost ~] # mysql-u root-p-- connect to mysql and enter the password mysql > show global variables like 'port' -- View port number +-+-+ | Variable_name | Value | +-+-+ | port | 3306 | +-+-+ 1 row in set (0.00 sec) 10. Connect to mysql using navcat

This is the end of "how to install MySQL using yum in Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Services passwords systems content addresses more users knowledge devices input utility learning next slogans commands dilemmas characters character sets actual customers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Xiaomi Shulou Tech Info Shulou Information vpn