linux虚拟主机Mysql建立的方法如下:
专享主机的mysql数据存放目录为 /data/mysql/
mysql安装目录为 /usr/local/mysq/
1、建立用户数据库
# cd /data/mysql/
# mkdir test_db
2、建立mysq用户
登录mysql
# /usr/local/mysql/bin/mysql -uroot –p主机密码
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 315660 to server version: 4.0.26-standard-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>use mysql;
建立mysql用户名和密码
mysql>insert into user values
('localhost','test',PASSWORD('abcd1234'),'N','N','N','N','N','N',
'N','N','N','N','N','N','N','N','N','N','N',
'N','N','N','N','N','N','N','N',0,0,0);
建立mysql用户与库的关联
mysql>insert into db values
('localhost',' test_db',' test','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y');
刷新系统权限表
mysql>FLUSH PRIVILEGES;
退出myqsl
mysql>exit
可以使用 # /usr/local/mysql/bin/mysql –u数据库用户名 –p数据库密码 来测试刚才建立的数据库用户是否可以正常登录,如果成功登录mysql操作界面,则说明数据库用户成功建立。