马哥笔记-mysql
反關系模型:NoSQL
MongoDB
Redis
HBase
MySQL版本:
Community Edition
Enterprise Edition
軟件包格式: mysql, mysql-server, php53-mysql
centos倉庫包
mysql官方特定rpm包(不建議)
mysql官方通用rpm包(不建議)
mysql官方源碼包?
安裝:
yum install mysql-server
安裝完畢:
mysql ? --client
mysqld ?--server
tcp/3306
/var/lib/mysql
初始化:建立元數據庫
service mysqld start ?第一次啟動會自動初始化元數據庫
----------------------------------------------------------------------------------------------
[root@localhost html]# service mysqld start
Initializing MySQL database: ?Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. ?This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
----------------------------------------------------------------------------------------------
mysql?
-u Username
-p password
-h MySQL_SERVER?
獨特的mysql用戶: Username@Host, 二者構成一個完整的用戶,HOST不同,可能不能登錄
例如: select user, host, password from mysql.user;
mysql連接數據庫后,/var/lib/mysql/ 目錄下有個mysql.lock文件
每創建一個DB,在/var/lib/mysql/ 就多一個同名目錄
mysql客戶端:
交互式命令
客戶端命令: q
服務器端命令: 必須使用語句結束符(;)
批處理命令(執行myql腳本)
設定用戶密碼:
方法一:
select user, host, password from mysql.user;
SET PASSWORD FOR 'username'@'host'=PASSWORD('password');
set password for 'root'@'localhost'=PASSWORD('123');?
FLUSH PRIVILEGS;
方法二:
update user set Password=PASSWORD('password') where user='User';
方法三:shell里面操作
mysqladmin -uUsernmame -hHOST -p password 'password'
mysqladmin -uroot -hlocalhost -p password '456'
授予權限:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.%.%' IDENTIFIED BY 'pass123';
圖形化客戶端:
1,phpMyAdmin ?phpMyAdmin-3.4.3.2-all
2, WorkBench
3, Mysql front
4, Navicat for Mysql
轉載于:https://blog.51cto.com/go2duo/1608929
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的马哥笔记-mysql的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Sublime Text 3 全套快捷键
- 下一篇: CI中PHP写法规范(不断更新)