Centos 7 mysql数据库安装过程

Centos 7 mysql数据库安装过程

 

 

https://blog.csdn.net/weixin_42734930/article/details/81743047 数据库MySQL centos系统安装步骤、

 

 

[root@localhost local]# ls

bin    include  libexec                                     share

etc    lib      mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz  src

games  lib64    sbin                                        wordpress-5.2.2-zh_CN.zip

[root@localhost local]# tar -zxvf mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz  解压

[root@localhost local]# ls

bin      lib64                                       share

etc      libexec                                     src

games    mysql-5.7.25-linux-glibc2.12-x86_64         wordpress-5.2.2-zh_CN.zip

include  mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

lib      sbin 

[root@localhost local]# mv mysql-5.7.25-linux-glibc2.12-x86_64 mysql   重命名

[root@localhost local]# ls

bin      lib64                                       share

etc      libexec                                     src

games    mysql                                       wordpress-5.2.2-zh_CN.zip

include  mysql-5.7.25-linux-glibc2.12-x86_64.tar.gz

lib      sbin

[root@localhost local]# groupadd msyql

[root@localhost local]# user

useradd     userdel     userhelper  usermod     usernetctl  users       

[root@localhost local]# useradd -r -g mysql mysql

useradd:用户“mysql”已存在       创建用户和组

[root@localhost local]# chown -R mysql.mysql /usr/local/mysql   更改安装目录所属的组

[root@localhost local]# mkdir data  创建文件data文件夹

[root@localhost local]# /usr/local/mysql/bin/mysql_install_db  --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data   初始化数据库

2020-01-02 17:44:04 [WARNING] mysql_install_db is deprecated. Please consider switching to mysqld --initialize

2020-01-02 17:44:06 [WARNING] The bootstrap log isn't empty:

2020-01-02 17:44:06 [WARNING] 2020-01-02T09:44:04.218322Z 0 [Warning] --bootstrap is deprecated. Please consider using --initialize instead

2020-01-02T09:44:04.219026Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)

2020-01-02T09:44:04.219039Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)

 

[root@localhost local]# /usr/local/mysql/bin/mysql_install_db  --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --initialize

mysql_install_db: [ERROR] unknown option '--initialize'

2020-01-02 17:44:32 [ERROR]   Unrecognized options

 

 

 

[root@localhost local]# vi /etc/my.cnf  编辑配置文件

 

mysqld]

datadir=/usr/local/mysql/data

basedir=/usr/local/mysql

socket=/var/lib/mysql/mysql.sock

user=mysql

port=3306

character-set-server=utf8

skip-grant-tables

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

# Settings user and group are ignored when systemd is used.

# If you need to run mysqld under a different user or group,

# customize your systemd unit file for mariadb according to the

# instructions in http://fedoraproject.org/wiki/Systemd

 

[mysqld_safe]

log-error=/var/log/mariadb/mariadb.log

pid-file=/var/run/mariadb/mariadb.pid

 

#

# include all files from the config directory

#

!includedir /etc/my.cnf.d

 

~                                                                                      

"/etc/my.cnf" 24L, 667C

 

 

[root@localhost local]# cp /usr/local/mysql/support-files/mysql.server /etc/in

init.d/  inittab  inputrc  

[root@localhost local]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d 添加mysql 到服务

[root@localhost local]# chkconfig mysql on  开机启动

[root@localhost local]# service mysql st

start   status  stop    

[root@localhost local]# service mysql start 启动数据库

 

Starting MySQL. SUCCESS!

[root@localhost local]# mysql -u root -p   修改密码

Enter password:

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.7.25 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

 

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

 

MySQL [(none)]>

MySQL [(none)]>

MySQL [(none)]>

MySQL [(none)]>

MySQL [(none)]> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

MySQL [mysql]> updata user set authentication_string =156102wpf29 where user ='root'

    -> flush privleges

    -> exit

    -> quit

    ->

posted @ 2020-01-03 15:08  道阻、且长  阅读(277)  评论(0)    收藏  举报