linux下安装mysql
2008-12-11 22:06
176 查看
#tar zxvf mysql-4.1.18.tar.gz
#cd mysql-4.1.18
#./configure --prefix=/usr/local/mysql --with-charset=gb2312 --with-extra-charsets=all
#make
#make install
#make clean
#cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
#groupadd mysql
#useradd -g mysql mysql
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql
#建立基本数据库,必须指明为mysql用户,出现如下:
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
Unknown suffix '@' used for variable 'port' (value '@MYSQL_TCP_PORT@')
080425 4:38:40 /usr/local/mysql/libexec/mysqld: Error while setting value '@MYSQL_TCP_PORT@' to 'port'
Installation of grant tables failed!
Examine the logs in /usr/local/mysql/var for more information.
You can also try to start the mysqld daemon with:
/usr/local/mysql/libexec/mysqld --skip-grant &
You can use the command line tool
/usr/local/mysql/bin/mysql to connect to the mysql
database and look at the grant tables:
shell> /usr/local/mysql/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /usr/local/mysql/var that may be helpful.
The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/local/mysql/bin/mysqlbug script!
启动
# bin/mysqld_safe --user=mysql & #出现如下提示:
[1] 23095
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
###这样就停在这边,就是正常启动。如果想确认用下面命令
# ps -aux |grep mysql
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
root 23095 0.1 0.2 4408 1084 pts/1 S 04:44 0:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 23118 3.1 2.4 114464 12676 pts/1 Sl 04:44 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/localhost.localdomain.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock
root 23128 0.0 0.1 5524 640 pts/1 R+ 04:44 0:00 grep mysql
###这样表示正常启动
#bin/mysqladmin -uroot password 123456 (设置mysql的root密码为123456,默认是空的)
## bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
#bin/mysqld_safe &或/usr/local/mysql/share/mysql/mysql.server start 启动mysql
#/usr/local/mysql/share/mysql/mysql.server stop 停止mysql
#ps -aux|grep mysql查看进程
#kill id号 ----这是杀mysql进程的,id号是在查看mysql进程里面看的到。
我们来修改一下mysql的启动的方式,让它以系统守护进程的方式开户服务
#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld 这样下次就可以用/etc/init.d/mysqld start启动了
# bin/mysql -uroot -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个是mysql没启动
# /etc/init.d/mysqld start (或/usr/local/mysql/mysql/share/mysql.server start这样启动)
# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.00 sec)
mysql>
#chkconfig --add mysqld 添加mysql为服务
#chkconfig --del mysqld 删除mysql服务本文出自 “小客” 博客,请务必保留此出处http://peiyan.blog.51cto.com/344889/118921
#cd mysql-4.1.18
#./configure --prefix=/usr/local/mysql --with-charset=gb2312 --with-extra-charsets=all
#make
#make install
#make clean
#cp /usr/local/mysql/share/mysql/my-huge.cnf /etc/my.cnf
#groupadd mysql
#useradd -g mysql mysql
#cd /usr/local/mysql
#bin/mysql_install_db --user=mysql
#建立基本数据库,必须指明为mysql用户,出现如下:
Preparing db table
Preparing host table
Preparing user table
Preparing func table
Preparing tables_priv table
Preparing columns_priv table
Installing all prepared tables
Unknown suffix '@' used for variable 'port' (value '@MYSQL_TCP_PORT@')
080425 4:38:40 /usr/local/mysql/libexec/mysqld: Error while setting value '@MYSQL_TCP_PORT@' to 'port'
Installation of grant tables failed!
Examine the logs in /usr/local/mysql/var for more information.
You can also try to start the mysqld daemon with:
/usr/local/mysql/libexec/mysqld --skip-grant &
You can use the command line tool
/usr/local/mysql/bin/mysql to connect to the mysql
database and look at the grant tables:
shell> /usr/local/mysql/bin/mysql -u root mysql
mysql> show tables
Try 'mysqld --help' if you have problems with paths. Using --log
gives you a log in /usr/local/mysql/var that may be helpful.
The latest information about MySQL is available on the web at
http://www.mysql.com
Please consult the MySQL manual section: 'Problems running mysql_install_db',
and the manual section that describes problems on your OS.
Another information source is the MySQL email archive.
Please check all of the above before mailing us!
And if you do mail us, you MUST use the /usr/local/mysql/bin/mysqlbug script!
启动
# bin/mysqld_safe --user=mysql & #出现如下提示:
[1] 23095
[root@localhost mysql]# Starting mysqld daemon with databases from /usr/local/mysql/var
###这样就停在这边,就是正常启动。如果想确认用下面命令
# ps -aux |grep mysql
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.3/FAQ
root 23095 0.1 0.2 4408 1084 pts/1 S 04:44 0:00 /bin/sh bin/mysqld_safe --user=mysql
mysql 23118 3.1 2.4 114464 12676 pts/1 Sl 04:44 0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/localhost.localdomain.pid --skip-locking --port=3306 --socket=/tmp/mysql.sock
root 23128 0.0 0.1 5524 640 pts/1 R+ 04:44 0:00 grep mysql
###这样表示正常启动
#bin/mysqladmin -uroot password 123456 (设置mysql的root密码为123456,默认是空的)
## bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
#bin/mysqld_safe &或/usr/local/mysql/share/mysql/mysql.server start 启动mysql
#/usr/local/mysql/share/mysql/mysql.server stop 停止mysql
#ps -aux|grep mysql查看进程
#kill id号 ----这是杀mysql进程的,id号是在查看mysql进程里面看的到。
我们来修改一下mysql的启动的方式,让它以系统守护进程的方式开户服务
#cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld 这样下次就可以用/etc/init.d/mysqld start启动了
# bin/mysql -uroot -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个是mysql没启动
# /etc/init.d/mysqld start (或/usr/local/mysql/mysql/share/mysql.server start这样启动)
# bin/mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.25-log
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> show databases;
+----------+
| Database |
+----------+
| mysql |
| test |
+----------+
2 rows in set (0.00 sec)
mysql>
#chkconfig --add mysqld 添加mysql为服务
#chkconfig --del mysqld 删除mysql服务本文出自 “小客” 博客,请务必保留此出处http://peiyan.blog.51cto.com/344889/118921
相关文章推荐
- linux下不使用yum安装apache、mysql、php、yaf
- linux安装mysql
- linux系统安装mysql
- linux mysql 安装
- linux tomcat jdk mysql 免安装 绿色版整合
- Linux下Mysql安装详解
- Linux下 快速安装mysql数据库(附mysql下载路径)
- Linux中Centos7下安装Mysql(更名为Mariadb)
- Linux安装mysql并配置外网访问的实例
- 新版mysql+apache+php Linux安装指南
- Linux下安装MySQL出现“ls: /var/lib/mysql/*.pid: 没有那个文件或目录”
- linux 安装mysql yum
- 【mysql学习】linux安装mysql,使用install脚本方式 (二)
- linux安装完mysql后启动错误
- Linux下mysql 5.6.17安装图文教程详细版
- Linux下Apache PHP MYSQL 默认安装路径
- 在linux下安装JDK+Tomcat+mysql
- 在Linux下安装和使用MySQL
- linux安装mysql无法支持gbk字符编码的解决方法
- linux安装mysql