linux - yum 安装配置mysql
来源:互联网 发布:上海税友有哪些软件 编辑:程序博客网 时间:2024/05/16 15:05
YUM查看可用安装包
[root@microlmj ~]# yum list mysql*
Available PackagesMySQL-python.x86_64 1.2.3-0.3.c1.1.el6 base mysql.x86_64 5.1.73-3.el6_5 updates mysql-bench.x86_64 5.1.73-3.el6_5 updates mysql-connector-java.noarch 1:5.1.17-6.el6 base mysql-connector-odbc.x86_64 5.1.5r1144-7.el6 base mysql-devel.x86_64 5.1.73-3.el6_5 updates mysql-embedded.x86_64 5.1.73-3.el6_5 updates mysql-embedded-devel.x86_64 5.1.73-3.el6_5 updates mysql-libs.x86_64 5.1.73-3.el6_5 updates mysql-server.x86_64 5.1.73-3.el6_5 updates mysql-test.x86_64 5.1.73-3.el6_5 updates
安装mysql,mysql-server,mysql-devel.
[root@microlmj~]# yum -y install mysql
[root@microlmj~]# yum -y install mysql-server
[root@microlmj~]# yum -y install mysql-devel---Complete!
设置字符编码
[root@microlmj~]# vi /etc/my.cnf [mysqld]datadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sockuser=mysql# Disabling symbolic-links is recommended to prevent assorted security riskssymbolic-links=0[mysqld_safe]log-error=/var/log/mysqld.logpid-file=/var/run/mysqld/mysqld.pid#new adddefault-character-set=utf8
启动服务
[root@microlmj init.d]# /etc/rc.d/init.d/mysqld start [ OK ]Starting mysqld: [ OK ]刚安装的mysql root 用户 是没有密码的 登录 自己设置密码
[root@microlmj init.d]# mysql -u rootWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.1.73 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>看一下用户列表
mysql> select user ,host, password from mysql.user;+------+-----------------------+----------+| user | host | password |+------+-----------------------+----------+| root | localhost | || root | ay14031710421034561bz | || root | 127.0.0.1 | || | localhost | || | ay14031710421034561bz | |+------+-----------------------+----------+5 rows in set (0.00 sec)密码栏都是空的
给root@localhost设置一个密码
mysql> set password for root@localhost=password('yourpassword');Query OK, 0 rows affected (0.00 sec)再看一下用户表
mysql> select user ,host, password from mysql.user;+------+-----------------------+-------------------------------------------+| user | host | password |+------+-----------------------+-------------------------------------------+| root | localhost | *7E7C3D7567802A1EC617020149BB4B81E551B5EB || root | ay14031710421034561bz | || root | 127.0.0.1 | || | localhost | || | ay14031710421034561bz | |+------+-----------------------+-------------------------------------------+5 rows in set (0.00 sec)退出再重新登录
mysql> exitBye[root@microlmj init.d]# mysql -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)需要密码了 -.-
输入密码登录 0>.<0
[root@microlmj init.d]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 7Server version: 5.1.73 Source distribution...Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>本地的访问就没问题了 perhaps -.-
但是俺想远程访问
新建个用户microlmj (*用root账户登陆先)
mysql> insert into mysql.user(Host,User,Password) values("%","microlmj",password("microlmj"));Host字段是 % 允许所有地址访问
刷新系统权限-.-
mysql> flush privileges;Query OK, 0 rows affected (0.00 sec)
[root@microlmj init.d]# mysql -u microlmj -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g....Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>用新建的用户登录 创建一个表试试
mysql> use test;Database changedmysql> show tables;Empty set (0.00 sec)mysql> create table user (id int primary key, name varchar(10));Query OK, 0 rows affected (0.01 sec)mysql> desc user;+-------+-------------+------+-----+---------+-------+| Field | Type | Null | Key | Default | Extra |+-------+-------------+------+-----+---------+-------+| id | int(11) | NO | PRI | NULL | || name | varchar(10) | YES | | NULL | |+-------+-------------+------+-----+---------+-------+2 rows in set (0.00 sec)好吧,用navicat测试一下远程访问行不行 -.-
连接成功 -.-
Complete!
-.-
0 0
- linux - yum 安装配置mysql
- linux yum 安装 配置 使用 mysql
- linux下yum安装配置mysql数据库
- linux yum安装mysql及配置
- linux yum 安装mysql
- linux yum 安装mysql
- linux yum 安装mysql
- linux yum 安装mysql
- linux yum 安装mysql
- linux yum 安装mysql
- linux 安装mysql yum
- Linux yum安装mysql
- linux yum 安装mysql
- linux mysql yum安装
- Linux yum安装mysql
- linux yum 安装mysql
- Linux Centos6.8 安装配置Mysql-5.7 yum 安装方式
- linux - yum 安装配置mysql可以远程连接
- hdu 1019 最小公倍数(LCM)
- CodeForces 104 B 猜答案
- CodeForces 104A
- UVALive 4579 Time Lapse Camera
- hdu 3940 愤怒的小鸟
- linux - yum 安装配置mysql
- hdu 2031 进制转换
- hdu 1021 Fibonacc Again 找规律
- hdu 2036 改革春风吹满地
- 爱数发布AnyShare 3.5,打造私有云存储的BOX
- hdu 2043
- Visual Studio 2012完美的拥抱GitHub
- poj 2000 Gold Coins
- CodeForces 110A Nearly Lucky N…