mysql简单安装使用
2014-12-14 22:27
281 查看
centos5.5 64bit上安装使用
1、yum install mysql
2、service mysqld start
如果不执行的话会出现问题
[root@rac1 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
执行过程
[root@rac1 ~]# service mysqld start
初始化 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/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h rac1 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/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/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
[确定]
启动 mysqld: [确定]
3、更改数据库root密码
[root@rac1 ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user
'root'@'localhost' (using password: YES)
[root@rac1 ~]# /usr/bin/mysqladmin -u root password 'loge'
4、然后登陆使用
[root@rac1 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.95 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
5、客户端连接出现问题ERROR 1130
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| rac1 | |
| rac1 | root |
+-----------+------+
5 rows in set (0.00 sec)
mysql> update user set host='%' where user='localhost';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update user set host='%' where host='localhost';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush priveges;
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 'priveges' at line 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
记得修改完刷新一下权限
ok!
另外mariadb操作一样
1、yum install mysql
2、service mysqld start
如果不执行的话会出现问题
[root@rac1 ~]# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
执行过程
[root@rac1 ~]# service mysqld start
初始化 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/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h rac1 password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/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/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
[确定]
启动 mysqld: [确定]
3、更改数据库root密码
[root@rac1 ~]# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user
'root'@'localhost' (using password: YES)
[root@rac1 ~]# /usr/bin/mysqladmin -u root password 'loge'
4、然后登陆使用
[root@rac1 ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.95 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
5、客户端连接出现问题ERROR 1130
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
+--------------------+
3 rows in set (0.00 sec)
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user from user;
+-----------+------+
| host | user |
+-----------+------+
| 127.0.0.1 | root |
| localhost | |
| localhost | root |
| rac1 | |
| rac1 | root |
+-----------+------+
5 rows in set (0.00 sec)
mysql> update user set host='%' where user='localhost';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 0 Changed: 0 Warnings: 0
mysql> update user set host='%' where host='localhost';
Query OK, 2 rows affected (0.00 sec)
Rows matched: 2 Changed: 2 Warnings: 0
mysql> flush priveges;
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 'priveges' at line 1
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
记得修改完刷新一下权限
ok!
另外mariadb操作一样
相关文章推荐
- MySQL简介,安装,简单使用
- elasticsearch 1.5 + mysql安装配置与简单使用
- MySQL 5.7 版本的安装及简单使用(图文教程)
- MySQL安装和简单使用
- Ubuntu Server 16.04.1 安装配置以及简单使用MySQL(云服务器配置)
- MySQL简介,安装,简单使用
- Mac OS下安装mysql及其简单使用
- mysql 安装 和简单使用技巧1
- CentOS使用yum安装mysql(超简单)
- Redis-port安装使用实现redis迁移codis,以及简单redis pipe实现将mysql迁移redis
- mysql的安装与简单使用以及myeclipse下与数据库的连接和使用
- Mac OS下安装mysql及其简单使用
- Linux下的MySQL安装与简单使用
- MySQL 5.7 版本的安装及简单使用(图文教程)
- MemSQL 的安装和简单使用 比Mysql快30倍的关系型数据库
- Mac OS下安装mysql及其简单使用
- 【数据库】MySQL的安装与简单使用
- mysql5.6.24的安装与简单使用
- linux上安装mysql及简单的使用
- 使用yum安装Mysql ,并进行简单配置