学电脑,学计算机 | 手机访问 | 加入收藏 | 设为首页 | RSS
当前位置:首页 > 服务器技术 > Web服务器 > 正文

LNMP中安装mysql5的一些问题及解决

发布时间:2012-03-20 15:58:21  来源:电脑技术学习网
【摘要】: LNMP中安装mysql5的一些问题及解决

[root@localhost mysql-5.0.40]# cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
[root@localhost mysql-5.0.40]# cd /usr/local/mysql/bin
[root@localhost bin]# ./mysql_install_db
[root@localhost bin]# cd ..
[root@localhost mysql]# ls
bin include info lib libexec man mysql-test share sql-bench var
[root@localhost mysql]# cd var
[root@localhost var]# ls
mysql mysql-bin.000001 mysql-bin.000002 mysql-bin.index test
[root@localhost var]# cd ..
[root@localhost mysql]# /usr/local/mysql/bin/mysqld
mysqld_multi mysqld_safe mysqldump mysqldumpslow
[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe &
[2] 23080
[root@localhost mysql]# chown: ‘mysql’: 无效的用户
Starting mysqld daemon with databases from /usr/local/mysql/var
STOPPING server from pid file /usr/local/mysql/var/localhost.localdomain.pid
080707 05:37:38 mysqld ended
[2]- Done /usr/local/mysql/bin/mysqld_safe
[root@localhost mysql]#
[root@localhost mysql]# chmod -R 777 var/
[root@localhost mysql]# /usr/local/mysql/bin/mysqld_safe &
[2] 23111
[root@localhost mysql]# chown: ‘mysql’: 无效的用户
Starting mysqld daemon with databases from /usr/local/mysql/var
STOPPING server from pid file /usr/local/mysql/var/localhost.localdomain.pid
080707 05:39:17 mysqld ended
[2]- Done /usr/local/mysql/bin/mysqld_safe
[root@localhost mysql]# groupadd mysql
[root@localhost mysql]# useradd mysql
useradd: group mysql exists - if you want to add this user to that group, use -g.
[root@localhost mysql]# useradd mysql -g mysql
[root@localhost mysql]# bin/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql/bin/mysqlbug script!
The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root@localhost mysql]# ls
bin include info lib libexec man mysql-test share sql-bench var
[root@localhost mysql]# chown -R root
chown: 参数太少
请尝试执行‘chown --help’来获取更多信息。
[root@localhost mysql]# chown -R root .
[root@localhost mysql]# chown -R mysql var
[root@localhost mysql]# chown -R mysql var/.
[root@localhost mysql]# chown -R mysql var/mysql/.
[root@localhost mysql]# chown -R mysql .
[root@localhost mysql]# bin/mysqld_safe --user=mysql &
[2] 30060
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
[root@localhost mysql]# ls
bin include info lib libexec man mysql-test share sql-bench var
[root@localhost mysql]# cp share/mysql/mysql
mysql_fix_privilege_tables.sql mysql_system_tables_data.sql
mysql-log-rotate mysql_system_tables.sql
mysql.server mysql_test_data_timezone.sql
[root@localhost mysql]# cp share/mysql/mysql
mysql_fix_privilege_tables.sql mysql_system_tables_data.sql
mysql-log-rotate mysql_system_tables.sql
mysql.server mysql_test_data_timezone.sql
[root@localhost mysql]# cp share/mysql/mysql.server /etc/rc.d/init.d/mysql
[root@localhost mysql]# /etc/rc
rc rc1.d rc3.d rc5.d rc.d rc.sysinit
rc0.d rc2.d rc4.d rc6.d rc.local
[root@localhost mysql]# /etc/rc.d/init.d/mysql stop
Shutting down MySQL.STOPPING server from pid file /usr/local/mysql/var/localhost.localdomain.pid
SUCCESS!
[root@localhost mysql]# 080707 05:51:50 mysqld ended
[2]- Done bin/mysqld_safe --user=mysql
[root@localhost mysql]# /etc/rc.d/init.d/mysql start
Starting MySQL. SUCCESS!
[root@localhost mysql]# mysql
-bash: mysql: command not found
[root@localhost mysql]# cd ..
[root@localhost local]# cd mysql/
[root@localhost mysql]# bin/my
myisamchk mysql_find_rows
myisam_ftdump mysql_fix_extensions
myisamlog mysql_fix_privilege_tables
myisampack mysqlhotcopy
my_print_defaults mysqlimport
mysql mysql_install_db
mysqlaccess mysql_secure_installation
mysqladmin mysql_setpermission
mysqlbinlog mysqlshow
mysqlbug mysql_tableinfo
mysqlcheck mysqltest
mysql_client_test mysqltestmanagerc
mysql_config mysqltestmanager-pwgen
mysql_convert_table_format mysql_tzinfo_to_sql
mysqld_multi mysql_upgrade
mysqld_safe mysql_upgrade_shell
mysqldump mysql_waitpid
mysqldumpslow mysql_zap
mysql_explain_log
[root@localhost mysql]# bin/my
-bash: bin/my: 没有那个文件或目录
[root@localhost mysql]# bin/mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.40-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> mysqladmin -uroot password 123
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin -uroot password 123' at line 1
mysql> mysqladmin -uroot password
-> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysqladmin -uroot password' at line 1
mysql> quit
Bye
[root@localhost mysql]# bin/mysqladmin -uroot password
bin/mysqladmin: Too few arguments to change password
[root@localhost mysql]# bin/mysqladmin -uroot password 123
[root@localhost mysql]# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.40-log Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> quit
Bye

蛋疼不解释。