日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

MySQL 管理方法

發(fā)布時間:2025/4/16 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MySQL 管理方法 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

MySQL 管理方法

一、Mysql介紹

二、Mysql啟動

三、Mysql用戶管理

一、Mysql介紹
MySQL是一個開放源碼的小型關(guān)聯(lián)式數(shù)據(jù)庫管理系統(tǒng),開發(fā)者為瑞典MySQL AB公司。目前MySQL被廣泛地應(yīng)用在Internet上的中小型網(wǎng)站中。由于其體積小、速度快、總體擁有成本低,尤其是開放源碼這一特點,許多中小型網(wǎng)站為了降低網(wǎng)站總體擁有成本而選擇了MySQL作為網(wǎng)站數(shù)據(jù)庫。

二、Mysql啟動
1.檢查mysql是否啟動

[root@control data]# ps -ef | grep mysqld root 7856 2569 0 22:28 pts/0 00:00:00 grep --color=auto mysqld

2.查看mysql狀態(tài)并啟動

[root@control data]# systemctl enable --now mysqld Created symlink /etc/systemd/system/multi-user.target.wants/mysqld.service → /usr/lib/systemd/system/mysqld.service. [root@control data]# systemctl status mysqld.service ● mysqld.service - MySQL 8.0 database serverLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Mon 2021-04-26 22:30:14 CST; 7s agoProcess: 8039 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)Process: 7960 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status>Process: 7936 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)Main PID: 7997 (mysqld)Status: "SERVER_OPERATING"Tasks: 38 (limit: 24900)Memory: 418.5MCGroup: /system.slice/mysqld.service└─7997 /usr/libexec/mysqld --basedir=/usr

mysql進程查看

[root@control data]# ps -ef | grep mysqld mysql 7997 1 2 22:30 ? 00:00:01 /usr/libexec/mysqld --basedir=/usr root 8085 2569 0 22:31 pts/0 00:00:00 grep --color=auto mysqld

三、Mysql用戶管理
1.驗證登錄mysql
①查看mysql版本

[root@control bin]# mysqladmin --version mysqladmin Ver 8.0.13 for Linux on x86_64 (Source distribution)

②跳過mysql登錄密碼

[root@control ~]# vim /etc/my.cnf [root@control ~]# cat /etc/my.cnf # # This group is read both both by the client and the server # use it for options that affect everything #[client-server][mysqld] explicit_defaults_for_timestamp=true skip-grant-tables# # include all files from the config directory # !includedir /etc/my.cnf.d

③修改密碼

[root@control ~]# systemctl restart mysqld.service [root@control ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 7 Server version: 8.0.13 Source distributionCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.08 sec)mysql> exit Bye

去掉/etc/my.cnf添加內(nèi)容,重啟服務(wù)

[root@control ~]# vim /etc/my.cnf [root@control ~]# systemctl restart mysqld.service

④登錄mysql進行測試

[root@control ~]# mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 9 Server version: 8.0.13 Source distributionCopyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>

總結(jié)

以上是生活随笔為你收集整理的MySQL 管理方法的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。