安装centos时选择安装Mysql 服务器

mysql的默认登录密码为空,但是直接登录的时候有报错:

[root@localhost bin]# mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

应该是没有起mysql服务。

先查看mysql服务的状态:

[root@localhost bin]# /etc/rc.d/init.d/mysqld status
mysqld 已停

启动mysql服务:

[root@localhost bin]# /etc/rc.d/init.d/mysqld start
初始化 MySQL 数据库: WARNING: The host 'xxaq' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
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 xxaq 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 /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

[确定]
正在启动 mysqld: [确定]

查看mysql状态

[root@localhost bin]# ps -aef|grep mysql
root 17468 1 0 08:57 pts/1 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
mysql 17573 17468 0 08:57 pts/1 00:00:00 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root 17600 17169 0 08:57 pts/1 00:00:00 grep mysql

此时再登录,没有报错:

[root@localhost bin]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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.

mysql>

centos默认安装mysql的默认密码的更多相关文章

  1. Oracle 10g 默认安装带来的用户名/密码

    ORACLE数据库创建的时候,创建了一系列默认的用户和表空间 Oracle 10g 默认安装带来的用户名/密码 Username Password Description See Also CTXSY ...

  2. 使用rpm安装mysql的默认目录

    --使用rpm安装mysql的默认目录:1.数据库目录/var/lib/mysql/2.配置文件/usr/share/mysql(mysql.server命令及配置文件)3.相关命令/usr/bin( ...

  3. Centos下安装mysql 总结

    一.MySQL安装 Centos下安装mysql 请点开:http://www.centoscn.com/CentosServer/sql/2013/0817/1285.html 二.MySQL的几个 ...

  4. Centos下安装mysql 和挂载硬盘

    一,CentOS下安装Mysql 6.5 1.检测系统是否自带安装mysql # yum list installed | grep mysql 2.删除已经安装的Mysql # yum -y rem ...

  5. 二进制安装MySQL及破解密码

    二进制安装MySQL及破解密码 1.确保系统中有依赖的libaio 软件,如果没有: yum -y install libaio 2.解压二进制MySQL软件包 tar xf mysql-5.7.24 ...

  6. CentOS 7 安装 MySQL Database

    CentOS 7 安装 MySQL Database 1. 现在安装包,MySQL的安装包被分成了社区版和企业版,而本文将记录社区版本MySQL安装过程,下载MySQL版本如下: mysql-5.7. ...

  7. 【linux系列】Centos下安装mysql数据库

    前言 为了测试方便,通常我们会自己安装数据库,以下是在Centos上安装Mysql的操作. 一.检查自己是否安装了MySQL数据库 [root@s201 /home/mysql]#rpm -qa |g ...

  8. 在centos上安装mysql

    本文依然是用的xftp上传gz文件,然后在xShell上操作的,如果没有安装使用这两个文件的请查阅之前的博客. 1.将下载好的文件用xftp上传到对应的位置. 2.解压文件:tar  -zvxf  m ...

  9. centos 7 安装MySQL 5.7.23

    centos 7 安装MySQL 5.7.23   1.  上传MySQL安装包到服务器 mysql-5.7.23-linux-glibc2.5-x86_64.tar.gz 2.  解压MySQL安装 ...

随机推荐

  1. nvm —— Node版本管理工具

    nvm下载 下载地址 下载nvm-setup.zip文件 nvm安装 1.以管理员身份运行install.cmd文件,设置文件路径 root: C:\Users\Administrator\AppDa ...

  2. 解决sql server2008数据库安装之后,web程序80端口被占用问题(终极方案)

    解决sql server2008数据库安装之后,web程序80端口被占用问题(终极方案) 前言:原来电脑上的Apache一直使用正常,在安装sql server2008后,突然发现Apache无法启动 ...

  3. google protocol 入门 demo

    ubunbu系统下google protobuf的安装 说明: 使用protobuf时需要安装两部分: 第一部分为*.proto文件的编译器,它负责把定义的*.proto文件生成对应的c++类的.h和 ...

  4. SequoiaDB 巨杉数据库Docker镜像使用教程

    为方便用户快速体验,SequoiaDB 巨杉数据库提供基于 Docker 的镜像.本文介绍如何在 Docker 环境下部署 SequoiaDB 分布式集群环境.   集群规划 我们准备在五个容器中部署 ...

  5. 02 Django虚拟环境搭建

    01 创建虚拟环境目录 该目录用于存放所有虚拟环境. cd / mkdir venv cd venv 02 创建当前项目的虚拟环境 virtualenv --python=/usr/bin/pytho ...

  6. AcWing 532. 货币系统

    #include <cstring> #include <iostream> #include <algorithm> using namespace std; ; ...

  7. EF CodeFirst配置领域类

    当我们不想使用EF的默认约定时,可以手动配置领域类,但还是推荐少配置,Simple is best! 两种配置方式: 1.Data Annotation Attributes[数据注解特性]  数据注 ...

  8. 【转载】Pig语法进阶

    转自:http://www.cnblogs.com/siwei1988/archive/2012/08/06/2624912.html Pig Latin是一种数据流语言,变量的命名规则同java中变 ...

  9. HDU1069 Monkey and Banana(dp)

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=1069 题意:给定n种类型的长方体,每个类型长方体无数个,要求长方体叠放在一起,且上面的长方体接触面积要小于 ...

  10. 208. 实现 Trie (前缀树)

    主要是记录一下这个数据结构. 比如这个trie树,包含三个单词:sea,sells,she. 代码: class Trie { bool isWord; vector<Trie*> chi ...