MySQL 管理方法
生活随笔
收集整理的這篇文章主要介紹了
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是否啟動
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=/usrmysql進程查看
[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版本
②跳過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)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Mysql数据库的安装教程
- 下一篇: Linux下Mysql数据库的基础操作