mysql初始化命令 mysql80初始化命令
Installing MySQL tables..../bin/mysqld: error.....这是什么错误啊?linux上安装mysql,??
7、修改root的密码为62386997Linux环境中,安装好MySQL后,还不能直接启动服务,必须先对数据库进行初始化。初始化的工作主要包括:
mysql初始化命令 mysql80初始化命令
mysql初始化命令 mysql80初始化命令
mysql初始化命令 mysql80初始化命令
初始化日志、表空间等数据库必须的文件;
创建并初始化系统数据库(mysql)。
初始化完成后,启动mysqld守护进程,方可访问数据库。
在Windows的环境下,安装包内已经自带了一个初始化好的环境重点是以下配置,其中datadir的目录名称必须是data,并且好像必须是MySQL目录下的data.之前自己制定了其他目录,一直出现1067的错误。,安装后展开在mysql根目录的data子目录。所以并不需要手工进行初始化。但是某些情况下,也可能需要从零开始初始化数据库,比如:
数据文件被破坏,需要重建;
希望保留现有环境不动,建立一个新的环境;
希望建立一个干净的环境。
不幸的是,Linux环境下是利用mysql_install_db.sh脚本初始化数据库环境的;而在Windows版中并没有提供相应的脚本。那么该怎么办呢?
经过对Linux环境下的mysql_install_db.sh的分析,发现初始化数据库的命令主要是以下几行:
启动mysql的docker镜像,怎么自动执行初始化sql脚本
Type '' for .在docker中有一个mysql服务,其数据文件是挂在在主机外面的文件,在docker中的root有访问该数据文件的权限,但是docker中mysql访问数据文件的时候提示权限不足,于是只有以root用户来启动mysql了。 数据初始化: mysql_instcharacter-set-server = utf8all_db --user=root -...
mysql5.7.12解压版怎么配置格式
thread_cache_size=8解压版怎么配置格式方法:
1、解压缩文件后,把文件夹根目录下的my-default.ini拷贝一份,命名为my.ini。
2、把my.ini里面的basedir和datadir的注释去掉,并设置这两个属性。
basedir=D:/Program Files (x86)/MySql # 设置mysql的安装目录
datadir=D:/Program Files (x86)/MySql/data # 设置mysql数据库的数据的存放目录,必须是data,或者是//xxx/data
注意两点:
(1)分隔符为“/”或“”
(2)虽然设置datadir时候,设置了一个data目录,但其实这时候安装目录下还没这个文件夹,也不需要手动建立,后面数据库初始化时会自动建立。如果提前手动建立了,后面初始化会出错(看网上说的,没有自己测试过)。
3、以身份启动CMD。必须以身份启动,不然后面进行数据库初始化或启动数据库时,会出错。
例如:发生系统错误5。这样的错误。
4、在CMD中输入下面的命令其中一个,进行初始化mysql。两个命令不同点如下,
(1)mysqld --initialize-insecure。这个方法初始化完后,root用户无密码。
(2)mysqld --initialize --console。这个方法初始化完后,root用户有密码。密码是console中输出的一段文字。
5、启动mysq如果你能编辑 你solaris上的 mysql_install_db 这个文件,请把文件开头的l: net start mysql。如正常启动,会显示正常启动的输出。
(停止命令:net stop mysql)
6、进入mysql:mysql -oot -p。
上面是无密码数据进入时的命令,如果数据库初始化时带密码的话,需要在-p后面加个空格,并写上密码。
如果在初始化数据库时,选择带有随机密码的方式,但又忘了密码的话,可以用下面的方法来修改密码。
1. 修改MySQL的配置文件(my.ini),在[mysqld]下添加一行skip-grant-tables
2. mysql 重启后,即可直接用 mysql -oot -p 进入(此时密码为空)
3. mysql> update mysql.user set authentication_string=password('123qaz') where user='root' and Host = 'localhost';
4. mysql> flush privileges;
5. mysql> quit;
6. 删除skip-grant-tables这一行,重新启动 MySQL
编译安装的 5.051 mysql初始化 提示/usr/local/mysql/bin/mysql_install_db: !: 找不到
if{echo"usemysql;";cat$create__tables$fill__tables;}|eval"$filter_cmd_line"|$mysqld_install_cmd_line>/dev/null#!/bin/sh
改为# InnoDB, unlike MyISAM, uses a buffer pool to cacheboth indexes and
#!/bin/bash
mysql忘记密码,如何修改
# Note that only client applications shipped by MySQLare guaranteed时隔半个月,我终于又开始刀mysql,但是不小心砍到了我的脑子,密码什么的我全都忘了,结果,你懂的。。所以,今天我就总结了一下网上的解决方法以及我自己的解决方法的一些心得。 方法一:免密码进入mysql再修改密码
步骤一:找到mysql安装目录下的配置文件,一般是my.ini。并在[mysqld]这一项的下方,添加 skip-grant-tables,然后保存文件。作如下: 步骤二:重启mysql服务, 可以通过:在我的电脑上右键–>服务–>找到mysql服务进行重启。
步骤三:免密登录,进入终端, 敲入 mysql -oot -p 命令然后回车 ,这时候就可以直接进入了
步骤四:修改成为自己的密码,在终端输入 set password for ‘username‘@‘host‘ = password(‘newpassword‘)就好。
注意事项:如果在输如mysql -oot -p后,显示如下图: 这表明还没有启动mysql数据库。在我的电脑上右键–>服务–>找到mysql服务进行启动就好。或者直接在终端输入net start mysql也可以启动。
方法二:遇事不决,重装解决。
前言:如果你有之前mysql的压缩包,重装其实也是很好解决的,相比其他方法,“后遗症”相对少很多。
步骤一:关闭mysql服务,我的电脑上右键–>服务–>找到mysql服务,并关闭服务,作如下: 注意:我这里是将mysql数据文件放到了F盘的MySQLsoft文件下的,删除的时候将该文件夹里面的内容删除就好,MySQLsoft文件不用删除,因为到时候解压MySQL压缩包的时候以及路径仍然是在这个目录下进行作。如果这个时候文件还是删除不了,重启电脑,再次进行上述的作就好。
步骤二:解压mysql压缩包,并在目录下添加my.ini文件,并在其中填入初始化内容。作如下:
右侧内容,文本形式如下:(注意:下面的设置mysql安装目录还有data存放目录需要改成mysql文件存放目录)
[mysqld]# 设置3306端口port=3306# 设置mysql的安装目录basedir=F:MySQLsoftmysql-8.0.20-winx64# 设置mysql数据库的数据的存放目录datadir=F:MySQLsoftmysql-8.0.20-winx64data# 允许连接数max_connections=200# 允许连接失败的次数。这是为了防止有人从该主机试图攻击数据库系统max_connect_errors=10# 服务端使用的字符集默认为UTF8character-set-server=utf8# 创建新表时将使用的默认存储引擎default-storage-engine=INNODB# 默认使用“mysql_native_password”插件认证default_authentication_plugin=mysql_native_password?[mysql]# 设置mysql客户端默认字符集default-character-set=utf8[client]# 设置mysql客户端连接服务端时默认使用的端口port=3306default-character-set=utf8 步骤三:在搜索栏输入cmd,在命令提示符上右键以的身份运行,并按照如下顺序输入即可:(如果之前配置过,那么前两步可以省去)
输入mysqld --initialize-insecure --user==mysql,正在初始化,稍等一会儿就行
输入mysqld -install(安装过的话可以不用安装)
输入net start mysql,启动mysql服务
输入mysql -oot -p,不用输入密码,直接回车
出现mysql>表示配置成功。
输入alter user user() identified by "密码";即可 上述就是我如何解决mysql忘记密码的问题了,还有就是快速修改法,本文参考如下:
mysql忘记密码,如何修# ./mysqladmin -oot password '新口令'改
标签:har重启modeloadedres忘记密码roosofstorage
win764位系统怎么安装mysql
# large settings.1、 MySQL Community 5.6.10
2、解压到d:MySQL.(路径自己指定)
3、在d:MySQL下新建my.ini配置文件,内容如下:
配置文件开始
# MySQL Instance Configuration File
#----------------------------------------------------------------------
# Generated by the MySQL Instance ConfigurationWizard
##
# Installation Instructions
#----------------------------------------------------------------------
##
# CLIENT SECTION
#----------------------------------------------------------------------
## The following options will be read by MySQL clientapplications.
# to read this section. If you want your own MySQLclient program to
# honor these values, you need to specify it as anoption during the
# MySQL client library initialization.
#[client]
port=3306
[mysql]
default-character-set=gbk
# SERVER SECTION
#----------------------------------------------------------------------
## The following options will be read by the MySQL .Make sure that
# you he installed the server correctly (see above)so it reads this
# file.
#[mysqld]
# The TCP/IP Port the MySQL will listen on
port=3306
#Path to installation directory. All paths are usuallyresolved relative to this.
basedir="d:MySQL"
#Path to the database root
datadir="d:MySQLData"
[WinMySQLadmin]
="d:MySQLbinmysqld.exe"
# The default character set that will be used when anew schema or table is
# created and no character set is defined
default-character-set=gbk
# The default storage engine that will be used whencreate new tables when
default-storage-engine=INNODB
# Set the SQL mode to strict
sql-mode="STRICT_TRANS_TABLES,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"
# The maximum amount of concurrent sessions the MySQLserver will
# allow. One of these connections will be reserved fora user with
# SUPER privileges to allow the administrator to loginn if the
# connection limit has been reached.
max_connections=100
# Query cache is used to cache SELECT results andlater return them
# without actual executing the same query once again.Hing the query
# cache enabled may result in significant speedimprovements, if your
# he a lot of identical queries and rarely changingtables. See the
# "Qcache_lowmem_prunes" status variable tocheck if the current value
# is high enough for your load.
# Note: In case your tables change very often or ifyour queries are
# textually different ry time, the query cache mayresult in a
# slowdown instead of a performance improvement.
query_cache_size=0
# The number of open tables for all threads.Increasing this value
# increases the number of file descriptors that mysqldrequires.
# Therefore you he to make sure to set the amount ofopen files
# allowed to at least 4096 in the variable"open-files-limit" in
# section [mysqld_safe]
table_cache=256
# Maximum size for internal (in-memory) temporarytables. If a table
# based table This limitation is for a single table.There can be many
# of them.
tmp_table_size=26M
# How many threads we should keep in a cache forreuse. When a client
# disconnects, the client's threads are put in thecache if there aren't
# more than thread_cache_size threads frombefore. This greatly reduces
# the amount of thread creations needed if you he alot of new
# connections. (Normally this doesn't give a notableperformance
# improvement if you he a good threadimplementation.)
# MyISAM Specific options
# The maximum size of the temporary file MySQL isallowed to use while
# recreating the index (during REPAIR, ALTER TABLE orLOAD DATA INFILE.
# If the file-size would be bigger than this, theindex will be created
# through the key cache (which is slower).
myisam_max_sort_file_size=100G
# If the temporary file used for fast index creationwould be bigger
# than using the key cache by the amount specifiedhere, then prefer the
# key cache mod. This is mainly used to force long character keys in
myisam_sort_buffer_size=52M
# Size of the Key Buffer, used to cache index blocksfor MyISAM tables.
# Do not set it larger than 30% of your ailable memory,as some memory
# is also required by the OS to cache rows. Even ifyou're not using
# MyISAM tables, you should still set it to 8-64M asit will also be
# used for internal temporary disk tables.
key_buffer_size=40M
# Size of the buffer used for doing full table scansof MyISAM tables.
# Allocated per thread, if a full scan is needed.
read_buffer_size=64K
read_rnd_buffer_size=256K
# This buffer is allocated when MySQL needs to rebuildthe index in
# REPAIR, OPTIMZE, ALTER table statements as well asin LOAD DATA INFILE
# into an empty table. It is allocated per thread sobe careful with
sort_buffer_size=256K
# INNODB Specific options
innodb_data_home_dir="d:MySQLDataINNODB"
# Use this option if you he a MySQL server withInnoDB support enabled
# but you do not plan to use it. This will se memoryand disk space
# and speed up some things.
#skip-innodb
# Additional memory pool that is used by InnoDB tostore metadata
# rmation. If InnoDB requires more memory for this pure it will
# start to allocate it from the OS. As this is fast enough on most
# recent operating s, you normally do not needto change this
# value. SHOW INNODB STATUS will display the currentamount used.
innodb_additional_mem_pool_size=2M
# If set to 1, InnoDB will flush (fsync) thetransaction logs to the
# willing to compromise this safety, and you arerunning all
# transactions, you may set this to 0 or 2 to reduce diskI/O to the
# logs. Value 0 means that the log is only written tothe log file and
# the log file flushed to disk approximay once persecond. Value 2
# means the log is written to the log file at eachcommit, but the log
# file is# recovery process. only flushed to disk approximay once persecond.
innodb_flush_log_at_trx_commit=1
# The size of the buffer InnoDB uses for buffering logdata. As soon as
# it is full, InnoDB will he to flush it to disk. Asit is flushed
# once per second anyway, it does not make sense tohe it very large
# (n with long transactions).
innodb_log_buffer_size=1M
# row data. The bigger you set this the less disk I/Ois needed to
# access data in tables. On a dedicated databaseserver you may set this
# parameter up to 80% of the machine physical memorysize. Do not set it
# cause paging in the operating . Note that on 32bit s you
# might be limited to 2-3.5G of user ll memory perprocess, so do not
# set it too high.
innodb_buffer_pool_size=77M
# Size of each log file in a log group. You should setthe combined size
# of log files to about 25%- of your buffer poolsize to oid
# unneeded buffer pool flush activity on log fileoverwrite. Howr,
# note that a larger logfile size will increase thetime needed for the
innodb_log_file_size=39M
# Number of threads allowed inside the InnoDB kernel.The optimal value
# depends highly on the application, hardware as wellas the OS
# scheduler properties. A too high value may lead tothread thrashing.
innodb_thread_concurrency=8
配置文件结束
配置文件也放在了附件里,大家可以根据需要修改。
#Path to installation directory. All paths are usuallyresolved relative to this.
basedir="d:MySQL"
#Path to the database root
datadir="d:MySQLData"
4、在windows环境变量里加入以下内容(方便执行命令行命令)
新建MYSQL_HOME="d:MySQL"
在Path里加入%MYSQL_HOME%bin
5、将mysql注册为windows系统服务。具体作是在命令行中执行以下命令:
mysqld install MySQL --defaults-file="d:MySQLmy.ini"
移除服务为 mysqld remove
6、第5步成功后,在命令行启动mysql
c:>net start mysql
方法一:
c:>mysql –uroot
mysql>use mysql;
mysql> UPDATE user SET password=PASSWORD("62386997") WHEREuser='root';
mysql> FLUSH PRIVILEGES;
mysql> QUIT
aix 安装mysql时,数据库初始化一直停留在Installing MySQL tables...,也不提示错误
# too large, though, because competition of thephysical memory mayLinux环境中,安装好MySQL后,还不能直接启动服务,必须先对数据库进行初始化。初始化的工作主要包括:
mysql>showdatabases;初始化日志、表空间等数据库必须的文件;
创建并初始化系统数据库(mysql)。
初始化完成后,启动mysqld守护进程,方可访问数据库。
在Windows的环境下,安装包内已经自带了一个初始化好的环境,安装后展开在mysql根目录的data子目录。所以并不需要手工进行初始化。但是某些情况下,也可能需要从零开始初始化数据库,比如:
数据文件被破坏,需要重建;
希望保留现有环境不动,建立一个新的环境;
希望建立一个干净的环境。
不幸的是,Linux环境下是利用mysql_install_db.sh脚本初始化数据库环境的;而在Windows版中并没有提供相应的脚本。那么该怎么办呢?
经过对Linux环境下的mysql_install_db.sh的分析,发现初始化数据库的命令主要是以下几行:
mysql_install_db.sh
#Pipemysql__tables.sqlto"mysqld--bootstrap"
s_echo"InstallingMySQLtables..."
then
s_echo"Fillingtables..."
#Pipefill__tables.sqlto"mysqld--bootstrap"
if{echo"usemysql;";cat$fill__tables;}|$mysqld_install_cmd_line>/dev/null
then
......
其中:
$create__tables、$fill__tables和$fill__tables分别是创建系统数据库、初始化系统数据库中的数据、和初始化帮助数据;
$filter_cmd_line是过滤掉主机名(用于交叉初始化非本机运行数据库环境的情况,可忽略);
$mysqld_install_cmd_line主要是"mysqld --bootstrap"命令;
# cd /usr/src
# tar -zvxf mysql-3.22.25-pc-linux-gnu-i686.tar.gz (产生 mysql-3.22.25-pc-linux-gnu-i686目录)
# cd mysql-3.22.25-pc-linux-gnu-i686
# ./configure --prefix=/usr/local/mysql (其中参数设定目的安装路径)
# make
# make install
注意在运行configure时,设定MySQL的安装目的路径为/usr/local/mysql,该路径在后继安装过程中还要使用。然后,建立初的数据库:
# scripts/mysql_install_db
该命令将在 /usr/local/mysql/var/ 下建立两个数据库:mysql和test,其中前者是MySQL的权限管理数据库,后者是让你做练习用的。注意:如果你在以前曾经安装果MySQL,则初始数据库已经存在,不需要再重新安装。
,启动MySQL :
# cd /usr/local/mysql/bin
# ./safe_mysqld &
如果你希望在机器启动的时候自动运行数据库服务,可以将上面的启动命令加入到/etc/rc.d/rc.local文件中。
现在,MySQL 已经运行起来了并等待你的数据处理命令!但是,一定要小心:你还没有为你的root设置一个密码,任何人都可以随心所欲地修改你的数据库(包括为重要的权限库)!不相信的话,作作以下练习(设我们的当前目录都是/usr/local/mysql/bin):
试试用任意用户登录,并运行:
$ ./mysql -oot
立即可以进入"mysql>"客户端软件提示符并进行任何数据处理作而不需要任何口令;这说明,MySQL的"root"账号与你的Unix账号所用的口令可以是不一样的。为了给root账号加口令,执行:
再次以一般用户身执行:
$ ./mysql -oot
则系统会提示输入密码,密码不正确则拒绝访问。实际上,即使你是root用户,如果不明确地指明使用密码,系统也是照样拒绝:
# ./mysql -oot
或# ./mysql 系统响应:
ERROR 1045: Access denied for user: 'root@localhost' (Using password: NO)
只有使用-p参数,明确说明你要使用密码,系统才会提示你输入密码,并在输入密码正确时方可进入:
# ./mysql -oot -p
password: (输入口令)
Welcome to the MySQL monitor. Commands end with ; or g.
Your MySQL connection id is 33 to server version: 3.22.25
Mysql>
键入exit回到shell。
脚本mysql.server(位于`share/mysql'目录中)用于启动或停止MySQL:
shell> mysql.server start
shell> mysql.server stop
该脚本实际上通过执行safe_mysqld启动。停止也可以通过管理程序实现:
mysqladmin shutdown
也可通过将下述命令加入`/etc/rc.local'文件,在系统启动时自动启动MySQL:
/bin/sh -c 'cd /usr/local/mysql ; ./bin/safe_mysqld &'
rpm安装mysql不初始化可以吗
s_echo"OK"如果/etc/目录下没有myf配置文件,请到/usr/share/mysql/下找到f文件,拷贝其中一个到/etc/并改名为myf中;不存在启动不了的情况啊,如有启动不了,仔细查看你的myf文件,是不是哪里配置需要修改,然后查看一下mysql启动脚本/etc/rc.d/init.d/mysql。重要的结合你mysql的错误日志去分析。
设置默认utf-8
在文件myf中加上如下配置:
[# grows larger than this value, it is automaticallyconverted to diskmysqld]
init_connect = 'SET NAMESutf8'
collation-server =utf8_general_ci
针对第三点:
在创建数据库完成后,查看下你数据库的字符集是什么?用show create database test;命令可以看到。必须保证你数据库的编码格式是utf-8的,这样才可以保证插入到数据库中的是中文格式的
mysql安装的时候,有一步是mysql_install_db --user=mysql,新手请教
# disk at each commit, which offers full ACIDbehior. If you are生成授权表实际上是完成了mysql的初始化。你在执行这个脚本之后,mysql里就会出现名为mysql的库。mysql库里有常用的权限表等系统表。比如设置用户权限的user表。
后面的参数--user所指定的用户是你想要运行mysqld进程用户名。这个是可变的,不一定非要是mysql。设置这个用户以后,所有通过mysqld进程创建的文件都会属于这个用户。网上的教程里多用mysql用户是为了在生产环境中更方便管理。
不知道这样说你能不能# large tables to use the slower key cache mod tocreate the index.明白。欢迎追问。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系 836084111@qq.com 删除。