在linux(ubuntu)下安装mysql:
version:5.0.*
tar.gz 二进制包
shell> adduser mysql
shell> cd /usr/local
shell> gunzip < /path/to/mysql-VERSION-OS.tar.gz | tar xvf -
shell> ln -s full-path-to-mysql-VERSION-OS mysql
shell> cd mysql
shell> chown -R mysql .
shell> chgrp -R mysql .
shell> scripts/mysql_install_db --user=mysql
shell> chown -R root .
shell> chown -R mysql data
--------------------
1、修改为UTF-8编码
shell> cp support-files/my-medium.cnf /etc/my.cnf
修改etc下的my.cnf
在[mysqld]和[mysql]下面添加:
default-character-set=utf8
2、删除对远程访问的dns回查(不然远程会很慢)
修改etc下的my.cnf
在[mysqld]下增加:
skip-name-resolve
-----------------
启动mysql:
shell> bin/mysqld_safe --user=mysql &
停止mysql:
shell> bin/mysqladmin -u root -p shutdown
登录数据库:
shell> bin/mysql -u root -p
---------------
添加远程登录权限:
mysql>use mysql;
mysql>update user set host = '%' where user ='root';
mysql>flush privileges;
mysql>select 'host','user' from user where user='root';
或:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.1.1' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;