mysql安装使用
==================
solaris中mysql安装
1 增加mysql用户
groupadd user; useradd -G mysql mysql
2 安装 pkgadd -d mysql-5.5.38-solaris10-x86_64.pkg
3 增加配置文件/opt/mysql/mysql/etc/my.cnf
cp ./support-files/my-medium.cnf ./etc/my.cnf
----------------
配置文件的读取优先顺序:
/etc/my.cnf
/etc/mysql/my.cnf
/opt/mysql/mysql/etc/my.cnf
~/.my.cnf
-----------------------
修改./etc/my.cnf
[mysqld]
basedir=/opt/mysql/mysql
datadir=/opt/mysql/mysql/data
character-set-server=gb2312
[mysql]
default-character-set=gb2312
[client]
default-character-set=gb2312
4 导入权限数据库
./scripts/mysql_install_db --defaults-file=./etc/my.cnf --user=mysql &
5 启动mysql数据库服务
/etc/init.d/mysql start
或
bin/mysqld_safe &
===========================
1. 创建用户
mysql> use mysql;
mysql> insert into user(host, user, password) values('%', 'CM', PASSWORD('CM'));
mysql> flush privileges;
mysql> create user 'dell'@'::1' identified by 'secret';
mysql> grand select on mydb.* to 'dell'@'::1';
2. 授权
GRANT ALL PRIVILEGES ON test.* TO 'asn'@'%';
注:(创建用户并授权)
GRANT ALL PRIVILEGES ON *.* TO 'asn'@'%' IDENTIFIED BY 'asn';
mysql> flush privileges;
2. 给用户root设置密码
/opt/mysql/mysql/bin/mysqladmin -u root password 'root'
直接在mysql数据库的用户表user中该用户密码
mysql> use mysql;
mysql> update user set password=PASSWORD('root') where user='root';
mysql> flush privileges;