linux mysql安装

ftp://mirror.leaseweb.com/mysql/Downloads/MySQL-5.1/


首先参考了:http://sheng.iteye.com/blog/830209 的博客。

(由于没有安装成功,所以在其博客的基础上做了相应的修改如下)
1、下载MySQL免安装版/二进制版软件(不用编译)
按照自己系统选择 http://www.mysql.com/downloads/installer/

2、创建MySQL组,建立MySQL用户并加入到mysql组中
(不同版本的Unix中,groupadd和useradd的语法可能会稍有不同。)
#groupadd mysql
#useradd -g mysql mysql

3、进入目录/usr/local,解压缩免安装版,并在此目录中建立名为 mysql的软连接
# tar -zxvf mysql-5.5.2-m2-linux-i686-glibc23.tar.gz
解压后会得到一个目录 mysql-5.5.2-m2-linux-i686-glibc23
在目录/usr/local 建立名字为mysql的软连接
#ln -s /opt/mysql-5.5.2-m2-linux-i686-glibc23 mysql

4、添加MySQL配置文件
如果你想要设置一个选项文件,使用support-files目录中的一个作为模板。在这个目录中有4个模板文件,是根据不同机器的内存定制的。
#cp support-files/my-medium.cnf /etc/my.cnf
说明support-files目录在你解压的 mysql-5.5.2-m2-linux-i686-glibc23 目录里面
(可能你需要用root用户运行这些命令。)
这里需要添加一些设置,否则会出现:The server quit without updating PID file 错误
编辑/etc/my.cnf文件
在[mysqld]下面加上:datadir=/usr/local/mysql/data
如下图所示:

其中/usr/local/mysql/data 就是mysql-5.5.2-m2-linux-i686-glibc23目录下的data目录
再到/usr/local/mysql/data 执行chown -R mysql:mysql *
然后杀掉mysql进程(没有mysql就算了)。

5、设定目录访问权限,用mysql_install_db创建MySQL授权表初始化,并设置mysql,root帐号访问权限
#cd mysql
#chown -R mysql .
#chgrp -R mysql .
#scripts/mysql_install_db –user=mysql
#chown -R root .
#chown -R mysql data
(注意以上命令中的" . "符号不能少。)

6、运行MySQL
#bin/mysqld_safe –user=mysql &
(如果没有问题的话,应该会出现类似这样的提示:
[1] 42264
# Starting mysqld daemon with databases from /usr/local/mysql/var

如果出现 mysql ended这样的语句,表示Mysql没有正常启动,你可以到log中查找问题,Log文件的通常在/etc/my.cnf中配置。

大多数问题是权限设置不正确引起的。 )

7、设置root密码。默认安装密码为空,为了安全你需要修改密码
#/usr/local/mysql/bin/mysqladmin -uroot password yourpassword

8、拷贝编译目录的一个脚本,设置开机自动启动
#cp support-files/mysql.server /etc/rc.d/init.d/mysqld
#chmod 700 /etc/init.d/mysqld
#chkconfig –add mysqld
#chkconfig –level 345 mysqld on

9、启动mysqld服务
#service mysqld start

10、查看3306端口是否打开。要注意在防火墙中开放该端口
#netstat -atln

解压版mysql安装完成后,用jdbc连接进行数据库操作,出现了一下问题:
Host xxx.xxx.xxx.xxx is not allowed to connect to this MySQL server
这涉及到了mysql的远程访问权限的问题。
那么如何开启Mysql的远程访问账号,请看如下资料:
增加允许远程连接 MySQL 用户并授权。

1)首先以 root 帐户登陆 MySQL
在 Windows 主机中点击开始菜单,运行,输入“cmd”,进入控制台,MySQL 的 bin 目录下,然后输入下面的命令。
在 Linux 主机中在命令提示行下输入下面的命令。(请使用mysql的root用户登录)
#mysql -uroot -p123456

2)创建远程登陆用户并授权
mysql>grant all PRIVILEGES on discuz.* to ted@'123.123.123.123' identified by '123456';
注意:上面的语句表示将 discuz 数据库的所有权限授权给 ted 这个用户,允许 ted 用户在 123.123.123.123 这个 IP 进行远程登陆,并设置 ted 用户的密码为 123456 。
下面逐一分析所有的参数:
all PRIVILEGES 表示赋予所有的权限给指定用户,这里也可以替换为赋予某一具体的权限,例如:select,insert,update,delete,create,drop 等,具体权限间用“,”半角逗号分隔。
discuz.* 表示上面的权限是针对于哪个表的,discuz 指的是数据库,后面的 * 表示对于所有的表,由此可以推理出:对于全部数据库的全部表授权为“*.*”,对于某一数据库的全部表授权为“数据库名.*”,对于某一数据库的某一表授权为“数据库名.表名”。
ted 表示你要给哪个用户授权,这个用户可以是存在的用户,也可以是不存在的用户。
123.123.123.123 表示允许远程连接的 IP 地址,如果想不限制链接的 IP 则设置为“%”即可。
123456 为用户的密码。
执行了上面的语句后,再执行下面的语句,方可立即生效。
mysql>flush privileges;

配置完成,已经可以使用了。就先写到这里吧!

补充:MySQL在Linux下安装数据库名、表名、列名、别名大小写规则:
1.数据库名和表名严格区分大小写;
2.表的别名严格区分大小写;
3.列名和列的别名在所有的情况下都忽略大小写;
4.变量名也是严格区分大小写的。

注意:
A、Linux下MySQL安装完后默认:区分表名的大小写,不区分列名的大小写。
B、改变表名的大小写区分规则的方法:用root帐号登录,在/etc/my.cnf 或 /etc/mysql/my.cnf 中的[mysqld]后添加添加lower_case_table_names=1,重启MySQL服务,若设置成功,则不再区分表名的大小写


一、准备工作
注:由于是在一台已经存在并经过多方使用的服务器上安装,所以需要先确认下该台服务器上是否已经安装Mysql
1、groupadd mysql 时提示 mysql 已存在,useradd -g mysql mysql 时也提示已存在,基本上可以确认已经安装过mysql;
切换到mysql下查看mysql进程,结果显示没有则表示当前 mysql 未启动;
输入 mysql start 时出现错误提示:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2), 先不研究这个错误了,准备重新安装mysql。
输入 rpm -qa|grep mysql ,无任何信息显示,表明之前不是以这种方式安装的,则不需要卸载,直接进行新的安装。

2、系统环境确认:
输入命令: uname -a 得到信息如下: Linux localhost.localdomain 2.6.9-55.ELsmp #1 SMP Fri Apr 20 17:03:35 EDT 2007 i686 i686 i386 GNU/Linux ,表明系统是32位;

3、下载Mysql 安装包:
从官网(http://www.mysql.com/downloads/mysql/ )下载相应的安装包(我的是 mysql-5.1.51-linux-i686-glibc23.tar.gz);

二、安装
1、新建 mysql 组和用户(已建,略过);
2、用 root 用户给 mysql 安装路径授权,依次执行:
Shell代码 收藏代码
MYSQL_BASE=/opt/mysql
mkdir -p $MYSQL_BASE/product/5.1
mkdir -p $MYSQL_BASE/mysqldata/mysqllog
mkdir -p /var/run/mysqld/
mkdir -p /etc/mysql
chmod -R 777 $MYSQL_BASE
chown -R mysql:mysql $MYSQL_BASE
chown -R mysql:mysql /etc/mysql
chown -R mysql:mysql /var/run/mysqld/
注:以上路径是我准备安装 mysql 的路径,部分路径与实际环境相关

3、切换到mysql 用户,设置 mysql 用户环境变量:编辑 /home/mysql/.bash_profile 文件,增加如下内容:
Txt代码 收藏代码
export MYSQL_BASE=/opt/mysql
export BASEDIR=$MYSQL_BASE/product/5.1
export DATADIR=$MYSQL_BASE/mysqldata
export LD_LIBRARY_PATH=$BASEDIR/lib:/lib:/usr/lib:/usr/local/lib
export TMPDIR=/tmp
export PATH=$PATH:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=$PATH:$BASEDIR/bin:$MYSQL_BASE:$BASEDIR:$LD_LIBRARY_PATH
4、将安装包上传到 mysql 用户主目录下,依次执行:
Shell代码 收藏代码
cd $BASEDIR
tar -zxvf /home/mysql/mysql-5.1.51-linux-i686-glibc23.tar.gz
cd $BASEDIR
cd mysql-5.1.51-linux-i686-glibc23
mv * ../
cd ..
rm -r mysql-5.1.51-linux-i686-glibc23
5、开始安装 mysql:
1) 执行:
Shell代码 收藏代码
cd $BASEDIR
./scripts/mysql_install_db --basedir=$BASEDIR --datadir=$DATADIR --user=mysql
出现类似如下文字则表示成功:
Txt代码 收藏代码
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:

/opt/mysql/product/5.1/bin/mysqladmin -u root password 'new-password'
/opt/mysql/product/5.1/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/opt/mysql/product/5.1/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 /opt/mysql/product/5.1 ; /opt/mysql/product/5.1/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql/product/5.1/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /opt/mysql/product/5.1/scripts/mysqlbug script!
2) 切换到 root 用户, 依次执行:
Shell代码 收藏代码
cd /opt/mysql/product/5.1
cp ./support-files/my-medium.cnf /etc/my.cnf
cp ./support-files/mysql.server /etc/init.d/mysql
chkconfig --add mysql
chkconfig --level 345 mysql on

3) 编辑 /etc/my.cnf 文件,找到如下片段:
Txt代码 收藏代码
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
在下面增加:
Txt代码 收藏代码
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
basedir = /opt/mysql/product/5.1
datadir = /opt/mysql/mysqldata
lower_case_table_names = 1
default-storage-engine = INNODB
innodb_additional_mem_pool_size = 16M
innodb_buffer_pool_size = 2G
innodb_data_file_path = ibdata1:1000M:autoextend
innodb_autoextend_increment = 64
innodb_file_per_table = 1
innodb_data_home_dir = /opt/mysql/mysqldata
innodb_file_io_threads = 4
innodb_thread_concurrency = 16
innodb_flush_log_at_trx_commit = 2
innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_log_files_in_group = 3
innodb_max_dirty_pages_pct = 40
innodb_lock_wait_timeout = 120
innodb_locks_unsafe_for_binlog = 1
innodb_autoinc_lock_mode = 2
修改 [client] 和 [mysqld] 下的 socket 那行为:
Txt代码 收藏代码
socket = /var/run/mysqld/mysqld.sock

注:Linux环境是区分大小写的,所以要加 lower_case_table_names = 1 这个配置
about lower_case_table_names:
0 - table names are stored as specified and comparisons are case sensitive.
1 - table names are stored in lowercase on disk and comparisons are not case sensitive.
2 - table names are stored as given but compared in lowercase. This option also applies to database names and table aliases.

4) 启动mysql, 用 mysql 用户执行: /etc/init.d/mysql start 显示:
Txt代码 收藏代码
Starting MySQL........................................................[ 确定 ]
则表示启动成功。
执行 ps ux 进行查看,有类似如下进程:
/opt/mysql/product/5.1/bin/mysqld --basedir=/opt/mysql/product/5.1 --datadir=/opt/mysql/mysqldata --user=mysql2 --log-error=/opt/mysql/mysqldata/localhost.localdomain.err --open-files-limit=8192 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/run/mysqld/mysqld.sock --port=3306

如需关闭数据库,则执行: /etc/init.d/mysql stop

三、初始设置
1、设置数据库root用户密码:
Mysql command代码 收藏代码
/opt/mysql/product/5.1/bin/mysqladmin -u root password 'new-password'
/opt/mysql/product/5.1/bin/mysqladmin -u root -p -h localhost.localdomain password 'new-password'

四、创建数据库
1、新建数据库用户 test ,密码也是 test,依次执行:
Shell代码 收藏代码
mysql -u root -p
mysql> insert into mysql.user(Host,User,Password) values("localhost","test",password("test"));
mysql> flush privileges;
mysql> exit;

2、创建数据库 testdb,并赋予 test 用户操作修改该数据库的权限,依次执行:
Shell代码 收藏代码
mysql -u root -p
mysql> create database testdb default character set utf8;
mysql> grant all privileges on testdb.* to test@localhost identified by 'test';
mysql> flush privileges;
mysql> exit;

3、用 test 用户登录,创建数据表等:
Shell代码 收藏代码
mysql -u test -p
mysql> use testdb;
...

至此,基本完成。
Linux rpm 安装 mysql Linux 在线安装 mysql1、检查是否安装老版本2、在线安装 mysql3、修改 mysql 密码4、配置 mysql4.1、添加编码支持中文4.2、MySQL 远程连接 (记得使用 root 账户进行操作,若使用普通用户,那么请修改相应文件夹权限,或配置普通用户 sudo 权限) 1、检查是否安装老版本 (1)检查以前是否装过 MySQL: rpm -qa|grep -i mysql (2)发现有的话就都卸载: rpm -e --nodeps mysql* (3)删除老版本 mysql 的开发头 阅读详情

相关推荐

昇腾CANN实战:如何用DVPP+AIPP实现32路视频流毫秒级预处理(附性能对比)

本文深入探讨了昇腾CANN架构中DVPP和AIPP模块在32路视频流毫秒级预处理中的硬件加速技术。通过异构计算架构的优化,实现了从传统CPU方案的40.7毫秒到CANN方案3.4毫秒的显著性能提升,特别适用于智能安防领域的实时视频分析需求。文章详细解析了DVPP多通道并行设计和AIPP模型级预处理融合的技术细节,并提供了性能对比数据与实战调优经验。

alice7model的博客 919

Linux上安装Mysql

Linux上安装MysqlLinux上安装MysqlLinux上安装软件常见的几种方式:使用yum进行安装修改密码及登录设置编码设置开机启动 Linux上安装Mysql Linux上安装软件常见的几种方式: 源码编译 压缩包解压(一般为tar.gz) 编译好的安装包(RPM、DPKG等) 在线安装(YUM、APT等) 以上几种方式便捷性依次增加,但通用性依次下降,比如直接下载压缩包进行解压,这种方式一般需要自己做一些额外的配置工作,但只要掌握了方法,各个平台基本都适用,YUM虽然简单,但是平台受限,网络

qq_41510551的博客 12万+

东方财富网股票API逆向分析:手把手教你破解动态参数(2024最新版)

本文详细解析了2024年东方财富网股票API的动态参数生成机制,包括回调函数、身份验证和时效控制参数的逆向工程方法。通过实战代码演示,帮助开发者破解动态参数,实现高效稳定的股票数据爬取,适用于金融数据分析和量化交易场景。

weixin_29091105的博客 1026

linux上安装MySQL

linux上原有mysql卸载,安装mysql过程及遇到的问题和解决方法 一、前期准备 二、安装MySQL 三、遇到的问题

m0_61232019的博客 9803

权重衰减weight_decay参数从入门到精通

Weight Decay是一个正则化技术,作用是**抑制模型的过拟合**,以此来提高模型的泛化性。 目前网上对于Weight Decay的讲解都比较泛,都是短短的几句话,但对于其原理、实现方式大多就没有讲解清楚,本文将会逐步解释weight decay机制。

iioSnail的博客 4万+

100天精通Python(基础篇)——第1天:Python从起源到应用的全面解析(附上Python、PyCharm、VSCode下载安装详细教程)

100天精通Python(基础篇)——第1天:Python从起源到应用的全面解析(附上Python、PyCharm、VSCode下载安装详细教程)

努力让自己发光,对的人才能迎着光而来 101万+

Linux中安装MySQL

mysql 、Linux

weixin_64420247的博客 1728

RuyiDify如何创建知识库API密钥:让程序安全访问知识库

知识库 API Key 是程序访问知识库的钥匙。创建它很简单,但真正重要的是知道它能做什么、应该放在哪里、不能暴露给谁。RuyiDify 讲这一步,不是为了让大家多记一个按钮,而是为了把知识库从“人工上传资料”推进到“程序化维护资料”。

未来已来,AI时代,学AI编程,做AI量化,就来大鹏AI教育。 136

在Linux上安装Mysql

参考:在Linux上安装mysql 下载 先去官网载MySQL Community Server,载第一个和第三个都行,只是解压的方式不同。 安装依赖库 apt install numactl apt install libaio-dev 解压软件包 解压 tar -xvf mysql-8.0.15-linux-glibc2.12-x86 这里有很重要的一步 一定要解压到/usr/local...

q435201823的博客 5050

如何设置反馈点

前面的POWER DC仿真都是忽略反馈线进行的仿真,如果单板压降不过,电源会自动调整输出电压,来满足负载的得到额定的电压.可以看到因为设置了反馈点,源端电压就被抬高到满足压降的值了。仿真上也可以自己添加反馈点,以得到抬高后的电源输出电压值。同样以下图的CPU的Core电源为例。按照流程正常设置好参数。

weixin_54787054的博客 1147

嵌入式开发环境Vscode开发STM32单片机程序

STM32单片机非常强大,大多数教程都是使用 keil 编译器,keil 是收费的而 gcc 是开源免费的。这里介绍一些使用 gcc +开发单片机程序的经验。(这里不解释 gcc 是什么)。

嵌入式技术开发 1843

linux下安装mysql

linux下安装MySQL

weixin_49807584的博客 4737

MATLAB基础应用精讲-【强化学习】Actor - Critic 算法(附python代码实现)

这种架构结合了策略梯度方法(Policy - Gradient Methods)和价值函数估计方法(Value Function Estimation Methods)的优点。在强化学习中,智能体(Agent)需要通过与环境(Environment)的交互来学习最优的行为策略,以获得最大的累积奖励(Cumulative Reward)。

qq_36130719的博客 363

Linux下安装MySQL

在安装MySQL之前首先使用命令检查环境下是否有MySQL,如果没有,则进行下一步,如果有,则需要先寻找教程完全卸载MySQL时候再进行安装。像这种情况,就说明环境里是没有MySQL的,可以继续下一步安装。

日暮南城故里的博客 1983

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

Linux上安装mysql

需要通过rpm相关指令,来查询当前系统中是否存在已安装的mysql软件包,执行指令如下:rpm -qa 查询当前系统中安装的所有软件rpm -qa | grep mysql 查询当前系统中安装的名称带mysql的软件rpm -qa | grep mariadb 查询当前系统中安装的名称带mariadb的软件我们可以通过管道符 | 配合着grep进行过滤查询。

weixin_52587747的博客 2012

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Linux中安装mysql

本文详细介绍了在Linux系统中安装MySQL数据库的两种主要方法:YUM在线安装和压缩包本地安装。YUM方式通过配置国内源(如阿里云)简化安装流程,包括添加MySQL仓库、选择版本、修改密码策略及设置远程访问等步骤。压缩包方式则需要手动解压、配置环境变量、初始化数据库并设置开机启动。两种方法均涉及防火墙配置(开放3306端口)和编码设置(UTF-8)等关键操作。文章还提供了MySQL卸载指南和密码策略修改技巧,建议优先使用YUM等便捷方式,必要时采用通用性更强的压缩包安装。

cxbtdd的博客 4010

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

在Linux上安装MySQL

在Linux上安装MySQL

LYQ 2167

Linux安装MySQL

Linux安装MySQL 一.使用工具putty_V0.63.0.0.43510830.exe连接linux http://download.youkuaiyun.com/detail/u012255016/9781901 Linux服务器输入用户和密码: 二.检查是否安装过mysql数据库,有则先卸载 1.检查是否安装mysql组件 2.先关闭mysql服务 3.查找mysql相应文件夹 4.卸载...

Camille66的博客 1086

在Linux中安装MySQL8

1、在Linux中安装MySQL8 1.1、下载指定的版本在MySQL官网上 1.2、解压下载的文件,上传到Linux上的opt目录下 将刚在官网上下载的文件解压,上传到Linux的**/opt**上(不需要将全部解压的全部上传) 1.3、确保环境没问题 1.3.1、检查当前环境是否安装过mysql rpm -qa | grep -i mysql 1.3.2、若安装过,将安装过的mysql删除干净 关闭 mysql 服务 systemctl stop mysqld.service

syh_IT 3344

linux下mysql一般安装在哪里,MySQL在Linux下的安装

昨晚上我本来就把 MySQL装好了,但是人太傻了,搞了两三个小时的原地踏步 (哈哈哈哈哈哈我还是先把步骤写出来,首先先将 MySQL上传到Linux检测Linux是否已经安装了 MySQL : rpm -qa | grep mysql将自带的MySQL卸载掉  :rpm -e --nodeps mysql-libs-5.1.73-5.el6_6.i686然后我在java里创建了一个...

weixin_33936194的博客 2133

linux线上安装mysql,linux如何线上安装mysql

linux线上安装mysql的方法:首先在linux中安装wget软件包;然后通过yum install命令安装mysql;最后通过“service mysqld restart”重启mysql服务即可。大体思路如下:1.wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm解释:wget是一个下载文件的工具,是...

weixin_32644565的博客 286

Linux下安装mysql

Linux下安装mysql

不更了,主打一个陪伴 1万+

linux内网安装mysql_Linux安装Mysql

Linux安装MysqlDotDotDot•2019 年 11 月 19 日Linux 安装Mysql1.检查是否安装Mysqlrpm -qa | grep mysql2.新建一个临时文件,使用wget下载Mysql安装包wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64....

weixin_27038701的博客 495

linux wget命令安装mysql_Linux下安装mysql

Mysql数据库的安装对于开发者来说,是我们必然会面对的问题,它的安装过程其实并不复杂,并且网络上的安装教程也非常多,但是对于新手来说,各种不同形式的安装教程,又给新手们带来了要选择哪种方式进行安装的难题,而且很多时候按照教程也没有能够安装成功,安装过程出现各种各样的错误。下面记录了我在Linux环境下安装Mysql的完整过程,如有错误或遗漏,欢迎指正。一 安装前准备1、检查是否已经安装过mysq...

weixin_26969269的博客 1248

Linux中mysql的安装

Linux中mysql的安装

m0_72596958的博客 845
上一篇: debian lenny的简单安装教程
下一篇: Ubuntu 12.04更新源
linshow26
博客等级 码龄14年 0粉丝 54原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值