mysql server安装
三. mysql server安装
------------------以下为扩展:删除mysql----------------
删除 mysql
sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql-server
sudo apt-get remove mysql-common //这个很重要 应该为自动删除autoremove
上面的其实有一些是多余的。
清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
--------------------扩展完毕--------------------------
1. mysql server安装
1.sudo apt-get install mysql-server mysql-client
2.输入root密码为root
3.更改mysql最大连接数:
sudo gedit /etc/mysql/my.cnf 增加或修改max_connections=1024;
2.进入mysql:
sudo mysql –u root -p 输入密码root进入。
3.添加/删除权限
语法如下:
grant all privileges(or other options) on *.* (or others) to username@"localhost( or % or otherIP)" identified by"username" (or with grant option);若with grant option则为超级用户。
revoke all privileges (or other options) on *.* (or others) from username(or username@"localhost( or % or otherIP)");
默认安转已经为root添加了本机权限,回收权限时请慎重对root权限回收。
注:回收权限并不删除用户。如果想删除,需要delete from user where USER like '...'
加权限的用户创建:
eg:mysql>grant all privileges on epaper.* to wenxin@'localhost' identified by 'xinwen365'; 意思是:允许wenxin从本地访问epaper数据库并且具有对该数据库的所有操作
mysql>grant all privileges on epaper.* to wenxin@'%' identified by 'xinwen365'; &nbs
相关文档:
把mysql.h复制到vc的目录的include目录下
mysql.h在你mysql的安装目录下的include里面如:mysql\include
把libmysql.lib(在mysql的安装目录下,搜索下就能找到)复制到这个目录下(C:\Program Files\Microsoft Visual Studio 9.0\VC\lib),要不连接会出错。
如果编译连接时还是出错。就把libmysql.lib复制到你源程序的目 ......
Each MySQL Cluster host computer running an SQL node must have
installed on it a MySQL binary. For management nodes and data
nodes, it is not necessary to install the MySQL server binary, but
management nodes require the management server daemon
......
记得前天有人问我, Memcache 和 MySQL 自己的 Query Cache 有啥区别? 我这样回答的,前者是山寨中的战斗机,后者是官方的战斗机。
新手回答问题,错了莫怪。哈哈哈。
好像细节上的差别还是有的。
Memcache优点如下:
1. 理论上可以支撑无限并发业务操作。
2. 可以启用单独的实例来缓存巨多的数据。(当 ......
MySQL索引
MySQL查询优化最重要的当属建立正确的索引,没有索引,面对海量数据,一切的优化纯属空话。什么是索引?索引为什么那么重要呢?这些问题这里就不谈了,还是先写下我首次优化MySQL查询海量数据的心得吧,数据库表类型是MyISAM。
如果简单的一个查询语句,MySQL查询速度还 ......
表设计方面:
1、字段名尽量简化,不要超过18个字符
2、使用尽量小的数据类型,例如:MEDIUMINT比INT少占用25%空间
3、字段类型应尽量避免设置成可变长度,如:VARCHAR、BLOB、TEXT
4、用于比较的不同字段,应设置相同的类型及长度
5、尽可能将字段声明为NOT NULL,并指定DEFAULT
6、主索引尽可能短
7、仅创建真正 ......