Mysql中的用户 user 每一个user都对应了不同的用户地址和权限
创建Mysql用户共有三种方式1、create user 2、grant 3、操作mysql.user表
1、CREATE USER 'username'@'host' IDENTIFIED BY 'password';
例子: CREATE USER 'aa'@'localhost' IDENTIFIED BY '123456';
CREATE USER 'aa'@'192.168.1.101_' IDENDIFIED BY '123456';
CREATE USER 'aa'@'%' IDENTIFIED BY '123456';
CREATE USER 'bb'@'%' IDENTIFIED BY '';
CREATE USER 'cc'@'%';
用户有两个部分组成 格式:名字@主机
aa@localhost 本机发起链接的aa用户
bb@152.236.20.10 客户端地址为152.236.20.10的用户bb
cc@% %通配符,表示所有
2、使用grant语句(授权方式)
语法:mysql> grant 权限1,权限2,...权限n on 数据库名称.表名称 to 用户名@用户地址 identified by '连接口令';
权限1,权限2,...权限n代表
select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限
实例:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。
mysql>grant all privileges on vtdc.* to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。
mysql>grant all privileges on *.* to joe@10.163.225.87 identified by '123';
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
mysql>grant all privileges on *.* to joe@localhost identified by '123';
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。
3、直接向mysql.user表插入记录:
mysql> insert into user (host,user,password) values ('%','jss_insert',password('jss'));
mysql>flush privileges; //刷新系统权限表
修改用户密码:1、mysqladmin 2、修改mysql.user表 3、set password
1、 使用mysqladmin语法:mysqladmin -u用户名 -p旧密码 password 新密码
例如:mysqladmin -u root -p 123 password 456;
2、 直接修改user表的用户口令:
语法:update mysql.user set password=password('新密码') where User="phplamp" and Host="localhost";
实例:update user set password=password('54netseek') where user='root';
flush privileges;
3、使用SET PASSWORD语句修改密码:语法:
SET PASSWORD FOR 'username'@'host' = PASSWORD('newpassword');
如果是当前登陆用户用SET PASSWORD = PASSWORD("newpassword");
实例:
set password for root@localhost=password('');
SET PASSWORD FOR name=PASSWORD('new password');
SET PASSWORD FOR 'pig'@'%' = PASSWORD("123456");
删除用户和撤销权限:1、drop user 2、取消授权用户 3、删除mysql.user表中的记录
1、 取消一个账户和其权限
Drop USER user;
drop user username@'%'
drop user username@localhost
2、 取消授权用户:
语法:REVOKE privilege ON databasename.tablename FROM 'username'@'host';
例子: REVOKE SELECT ON *.* FROM 'pig'@'%';
REVOKE SELECT ON test.user FROM 'pig'@'%';
revoke all on *.* from sss@localhost ;
revoke all on user.* from 'admin'@'%';
SHOW GRANTS FOR 'pig'@'%'; //查看授权
3、删除用户:
语法: Delete from user where user = "user_name" and host = "host_name" ;
例子:delete from user where user='sss' and host='localhost';
参考博文:http://blog.csdn.net/leili0806/article/details/8573636

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.